mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-26 22:16:20 +08:00
shutdown netmaker on reciept of sigterm
This commit is contained in:
parent
02233c5d8f
commit
854c20f772
1 changed files with 2 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
|
|
@ -59,7 +60,7 @@ func HandleRESTRequests(wg *sync.WaitGroup) {
|
||||||
|
|
||||||
// Relay os.Interrupt to our channel (os.Interrupt = CTRL+C)
|
// Relay os.Interrupt to our channel (os.Interrupt = CTRL+C)
|
||||||
// Ignore other incoming signals
|
// Ignore other incoming signals
|
||||||
ctx, stop := signal.NotifyContext(context.TODO(), os.Interrupt)
|
ctx, stop := signal.NotifyContext(context.TODO(), syscall.SIGTERM, os.Interrupt)
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
// Block main routine until a signal is received
|
// Block main routine until a signal is received
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue