Documentation
¶
Overview ¶
Package worker holds the loops a service runs in the background, beside the request path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Poll ¶
func Poll( ctx context.Context, logger logging.Log, name string, interval, stagger time.Duration, fn func(context.Context) (bool, error), )
Poll runs fn on a fixed interval until ctx is cancelled. When fn reports it did work, Poll runs it again immediately, so a backlog drains at full speed. An error is logged and the loop continues.
stagger delays the first run, so loops sharing an interval de-synchronize. name identifies the loop in its log lines and on its spans.
Give it the boot context: a request context dies at the server's own timeout.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.