runutil

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package runutil provides helpers to advanced function scheduling control like repeat or retry.

It's very often the case when you need to excutes some code every fixed intervals or have it retried automatically. To make it reliably with proper timeout, you need to carefully arrange some boilerplate for this. Below function does it for you.

For repeat executes, use Repeat:

err := runutil.Repeat(10*time.Second, stopc, func() error {
	// ...
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Repeat

func Repeat(interval time.Duration, stopc <-chan struct{}, f func() error) error

Repeat executes f every interval seconds until stopc is closed. It executes f once right after being called.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL