mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-05 14:56:49 +00:00
disabled main ctx cancelation
This commit is contained in:
parent
684b3f896f
commit
f4c501d3c5
1 changed files with 13 additions and 0 deletions
13
server.go
13
server.go
|
@ -285,7 +285,20 @@ func (s *server) Start() {
|
||||||
//Block until we receive a signal
|
//Block until we receive a signal
|
||||||
sig := <-sigCh
|
sig := <-sigCh
|
||||||
fmt.Printf("Got exit signal, terminating all processes, %v\n", sig)
|
fmt.Printf("Got exit signal, terminating all processes, %v\n", sig)
|
||||||
|
|
||||||
|
// Adding a safety function here so we can make sure that all processes
|
||||||
|
// are stopped after a given time if the context cancelation below hangs.
|
||||||
|
defer func() {
|
||||||
|
//time.Sleep(time.Second * 5)
|
||||||
|
log.Printf("error: doing a non graceful shutdown of all processes..\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}()
|
||||||
|
|
||||||
|
// TODO: The cancelation of all gracefully do not work, so adding a sleep here
|
||||||
|
// to be sure that the defered exit above are run before this cancelFunc.
|
||||||
|
time.Sleep(time.Second * 2)
|
||||||
s.ctxCancelFunc()
|
s.ctxCancelFunc()
|
||||||
|
fmt.Printf(" *** Done: ctxCancelFunc()\n")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue