boinkor-net / hoopsnake

A not-very-featureful SSH server for initrd that listens on your tailscale network
https://github.com/boinkor-net/hoopsnake
Apache License 2.0
2 stars 1 forks source link

Correct error handling on exit when serving prometheus metrics #61

Closed antifuchs closed 1 day ago

antifuchs commented 1 day ago

The logic for serving prometheus metrics was somewhat broken: It would attempt to check that the cancellation context didn't indicate that we should exit, but it would only do that before starting to serve.

Instead, first serve, and if serve returns a fault, check whether we're meant to exit. Oops.