1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-05 06:46:48 +00:00

disabled main ctx cancelation

This commit is contained in:
postmannen 2021-07-02 13:26:30 +02:00
parent 684b3f896f
commit f4c501d3c5

View file

@ -285,7 +285,20 @@ func (s *server) Start() {
//Block until we receive a signal
sig := <-sigCh
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()
fmt.Printf(" *** Done: ctxCancelFunc()\n")
}