We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4adff9 commit 9ad986fCopy full SHA for 9ad986f
share/cos/common.go
@@ -5,6 +5,8 @@ import (
5
"os"
6
"os/signal"
7
"time"
8
+ "syscall"
9
+ "log"
10
)
11
12
//InterruptContext returns a context which is
@@ -13,9 +15,11 @@ func InterruptContext() context.Context {
13
15
ctx, cancel := context.WithCancel(context.Background())
14
16
go func() {
17
sig := make(chan os.Signal, 1)
- signal.Notify(sig, os.Interrupt) //windows compatible?
- <-sig
18
+ signal.Notify(sig, os.Interrupt, syscall.SIGTERM) //windows compatible?
19
+ s := <-sig
20
+ log.Printf("Graceful shutdown signal received: %s", s)
21
signal.Stop(sig)
22
+ log.Println("Graceful shutdown complete.")
23
cancel()
24
}()
25
return ctx
0 commit comments