Commit 4b2e2228 authored by Matthew Holt's avatar Matthew Holt

sigtrap: Ensure cleanup actions happen before too many things go wrong

parent f26447e2
......@@ -41,14 +41,14 @@ func trapSignalsPosix() {
case syscall.SIGTERM:
log.Println("[INFO] SIGTERM: Shutting down servers then terminating")
exitCode := executeShutdownCallbacks("SIGTERM")
for _, f := range OnProcessExit {
f() // only perform important cleanup actions
}
err := Stop()
if err != nil {
log.Printf("[ERROR] SIGTERM stop: %v", err)
exitCode = 3
}
for _, f := range OnProcessExit {
f() // only perform important cleanup actions
}
os.Exit(exitCode)
case syscall.SIGUSR1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment