Documentation
¶
Overview ¶
Package interrupt provides a set of services for handling OS interrupt signals and in-place restarting of a server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Restart should be set to true prior to signalling the ShutdownRequestChan. Restart bool // ShutdownRequestChan is a channel that can receive shutdown requests ShutdownRequestChan = make(chan struct{}) // HandlersDone is closed after all interrupt handlers run the first // time an interrupt is signaled. HandlersDone = make(chan struct{}) )
Functions ¶
func AddHandler ¶
func AddHandler(handler func())
AddHandler adds a handler to call when a SIGINT (Ctrl+C) is received.
func GoroutineDump ¶
func GoroutineDump() string
GoroutineDump returns a string with the current goroutine dump in order to show what's going on in case of timeout.
func Listener ¶
func Listener()
Listener listens for interrupt signals, registers interrupt callbacks, and responds to custom shutdown signals as required
func RequestRestart ¶
func RequestRestart()
RequestRestart sets the reset flag and requests a restart
Types ¶
type HandlerWithSource ¶
type HandlerWithSource struct { Source string Fn func() }
HandlerWithSource is a callback and its origin source code location bundled.
Click to show internal directories.
Click to hide internal directories.