Add Worker Cleanup

This commit is contained in:
Samuel Lorch 2024-04-26 22:48:09 +02:00
parent 5dbd15c71c
commit 4194ab5944
2 changed files with 27 additions and 0 deletions

View file

@ -40,6 +40,9 @@ func Start(_conf config.Config) {
serverClose <- true
}()
stopCleanup := make(chan bool, 1)
go cleanupDeadWorkers(stopCleanup)
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, os.Interrupt)
select {
@ -50,6 +53,7 @@ func Start(_conf config.Config) {
stopCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
server.Shutdown(stopCtx)
cancel()
stopCleanup <- true
slog.Info("Done")
}
}