Browse Source

Force shutdown 5 seconds after signals

Ask Bjørn Hansen 2 years ago
parent
commit
f9722b0959
1 changed files with 5 additions and 0 deletions
  1. 5 0
      geodns.go

+ 5 - 0
geodns.go

@@ -159,6 +159,11 @@ func main() {
 	g.Go(func() error {
 	g.Go(func() error {
 		<-ctx.Done()
 		<-ctx.Done()
 		log.Printf("server shutting down")
 		log.Printf("server shutting down")
+		go func() {
+			time.Sleep(time.Second * 5)
+			log.Fatal("shutdown appears stalled; force exit")
+			os.Exit(99)
+		}()
 		return nil
 		return nil
 	})
 	})