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)

View File

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- This changes the project to: -->
- Fix hanging on service restart ([#853](https://github.com/TecharoHQ/anubis/issues/853))
## v1.21.0: Minfilia Warde
> Please, be at ease. You are among friends here.