Print stack traces to stderr when taking more than 10 secs to shutdown

This commit is contained in:
Daniel
2019-07-24 09:18:43 +02:00
parent 9cc5c789ec
commit d9ae6a140d

View File

@@ -88,9 +88,9 @@ func main() {
}
go func() {
time.Sleep(5 * time.Second)
fmt.Println("===== TAKING TOO LONG FOR SHUTDOWN - PRINTING STACK TRACES =====")
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
time.Sleep(10 * time.Second)
fmt.Fprintln(os.Stderr, "===== TAKING TOO LONG FOR SHUTDOWN - PRINTING STACK TRACES =====")
pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
os.Exit(1)
}()