worker

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 6 Imported by: 0

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.

Jump to

Keyboard shortcuts

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