Documentation
¶
Overview ¶
Package shutdown turns the first interrupt into a graceful stop and the second into an immediate exit.
Both akari binaries want the same behavior on Ctrl-C: acknowledge the request at once, let in-flight work wind down to a clean stopping point, then exit; and if the operator interrupts again, stop waiting and quit now. The context this package returns is cancelled on the first signal. It is meant for deciding whether to start new work, not for tearing down work already underway, so a single Ctrl-C lets the current unit finish: detach long-running calls with context.WithoutCancel and gate the loop on the returned context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Notify ¶
Notify installs an interrupt handler and returns a context cancelled on the first SIGINT or SIGTERM. ack runs once, just before the cancel, so the caller can log that shutdown has begun the instant the signal lands. A second signal exits the process with status 130 instead of waiting for graceful cleanup.
The returned stop unregisters the handler and cancels the context; defer it.
Types ¶
This section is empty.