Documentation
¶
Index ¶
Constants ¶
const DefaultHaltTimeout = 30 * time.Second
DefaultHaltTimeout is the default timeout for graceful shutdown of workers. This provides workers with a grace period to close connections, flush data, and clean up resources during the halt phase.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
Start is a blocking operation that will start processing the workers.
Workers are started concurrently and run until one of the following occurs: 1. A worker returns an error from Run() 2. A signal (SIGINT, SIGKILL, SIGTERM) is received 3. The provided context is canceled
When shutdown is triggered, all workers' Halt() methods are called concurrently with a fresh context that has DefaultHaltTimeout as its deadline. This ensures workers have a grace period to perform graceful shutdown operations such as closing connections or flushing data.
Types ¶
type Halter ¶
type Halter interface {
// Halt should tell the worker to stop doing work.
Halt(context.Context) error
}
Halter represents the behaviour for stopping a service worker.