Skip to content
Snippets Groups Projects
Verified Commit 01b84573 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

feat: improve shutdown handling


Signed-off-by: default avatarJanne Mareike Koschinski <janne@kuschku.de>
parent ecfd7051
No related branches found
No related tags found
No related merge requests found
Pipeline #2808 passed
......@@ -57,13 +57,16 @@ func main() {
if err := metrics.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Printf("error in metrics server: %s", err.Error())
}
log.Printf("metrics shut down, shutting down asynq as well")
srv.Shutdown()
}()
if err := srv.Run(mux); err != nil {
log.Printf("error in asynq server: %s", err.Error())
}
if err := metrics.Shutdown(context.Background()); err != nil {
log.Printf("error shutting down metrics server: %s", err.Error())
}
go func() {
if err := srv.Run(mux); err != nil {
log.Printf("error in asynq server: %s", err.Error())
}
log.Printf("asynq shut down, shutting down metrics as well")
if err := metrics.Shutdown(context.Background()); err != nil {
log.Printf("error shutting down metrics server: %s", err.Error())
}
}()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment