Documentation
¶
Overview ¶
Package signal provides cross-platform signal handling for graceful shutdown. Per AI.md PART 7: Signal handling must be platform-dependent with build tags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsShuttingDown ¶
func IsShuttingDown() bool
IsShuttingDown returns true if graceful shutdown is in progress
func KillProcess ¶
KillProcess sends signal to process (Unix) Per AI.md PART 7: killProcess helper
func Setup ¶
func Setup(cfg ShutdownConfig)
Setup configures signal handling with the given config This is the main entry point - it calls the platform-specific setupSignals
Types ¶
type ShutdownConfig ¶
type ShutdownConfig struct {
// Server is the HTTP server to shut down (optional if ShutdownFunc is provided)
Server *http.Server
// ShutdownFunc is called to perform shutdown (alternative to Server)
// If provided, this is called instead of Server.Shutdown
ShutdownFunc func(ctx context.Context) error
PIDFile string
InFlightTimeout time.Duration // Default: 30s
ChildTimeout time.Duration // Default: 10s
DatabaseTimeout time.Duration // Default: 5s
LogFlushTimeout time.Duration // Default: 2s
OnReopenLogs func() // Called on SIGUSR1 (Unix only)
OnDumpStatus func() // Called on SIGUSR2 (Unix only)
OnCloseDatabase func() // Called during shutdown
OnFlushLogs func() // Called during shutdown
GetChildPIDs func() []int // Returns child process PIDs
}
ShutdownConfig holds configuration for graceful shutdown
Click to show internal directories.
Click to hide internal directories.