fix(cmd/anubis): add signal handling to metrics server (#856)

This fixes a bug that was introduced in 68b653b0, in which the call
to metricsServer was passed a plain context.Background without
signal handling.

This commit adds back in the signal handling for the metrics server,
as well as for the Thoth client and storage backend.

Closes: #853

Signed-off-by: Emily Rowlands <emily@erowl.net>
This commit is contained in:
Emily Rowlands 2025-07-18 13:56:52 +00:00 committed by GitHub
parent 59515ed669
commit c59b7179c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -263,7 +263,10 @@ func main() {
return
}
ctx := context.Background()
// install signal handler
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
wg := new(sync.WaitGroup)
if *metricsBind != "" {
@ -414,10 +417,6 @@ func main() {
log.Fatalf("can't construct libanubis.Server: %v", err)
}
// install signal handler
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
var h http.Handler
h = s
h = internal.RemoteXRealIP(*useRemoteAddress, *bindNetwork, h)