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 canceled. When fn reports it did work, Poll runs it again immediately, so a backlog drains at full speed. A run that returns an error or panics is logged and recorded on its span with the fault's type in error.type. The loop then 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.
Each run is the root of its own trace, so each reaches the exporter as soon as it ends.
Give it the boot context: a request context dies at the server's own timeout.
Types ¶
This section is empty.