No need to explicitly call Stop() on runner loops

Once the context is canceled, the loops will exit, so there is no
need to explicitly Stop(). We just need to Wait() for the loops to
exit.
This commit is contained in:
Gabriel Adrian Samfira 2022-12-30 15:13:49 +00:00
parent d5f5524934
commit 72ec1bf68f

View file

@ -172,11 +172,7 @@ func main() {
if err := srv.Shutdown(shutdownCtx); err != nil {
log.Printf("graceful api server shutdown failed: %+v", err)
}
log.Printf("stopping runner loop")
if err := runner.Stop(); err != nil {
log.Printf("failed to shutdown workers: %+v", err)
os.Exit(1)
}
log.Printf("waiting for runner to stop")
if err := runner.Wait(); err != nil {
log.Printf("failed to shutdown workers: %+v", err)