Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseInterval ¶
ParseInterval parses a duration string and returns a time.Duration. Returns an error if the interval is invalid.
func RunOnce ¶
RunOnce executes the task function once immediately. Returns an error if the task fails.
func SetupGracefulShutdown ¶
func SetupGracefulShutdown() (context.Context, context.CancelFunc)
SetupGracefulShutdown creates a context that will be cancelled on SIGINT or SIGTERM. Returns the context and a cleanup function that should be deferred. This provides consistent signal handling across all tools.
func StartPeriodicTask ¶
StartPeriodicTask executes the given task function periodically at the specified interval. The task runs in a goroutine on each tick. The function blocks until the context is cancelled. If the context is cancelled, the ticker is stopped and the function returns nil.
func WaitForShutdown ¶
func WaitForShutdown()
WaitForShutdown blocks until SIGINT or SIGTERM is received. Use this in serve commands that don't need a cancellable context.
Types ¶
This section is empty.