probe: clean-up database connection after probe to prevent connection leak

Signed-off-by: Kurtis Bass <kurtis.bass@hinge.co>
This commit is contained in:
Kurtis Bass
2022-12-14 14:30:13 -05:00
parent 9bd9d83d73
commit 76223cdda8
2 changed files with 7 additions and 0 deletions

View File

@@ -104,6 +104,9 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
return
}
// Cleanup underlying connections to prevent connection leaks
defer pc.Close()
// TODO(@sysadmind): Remove the registry.MustRegister() call below and instead handle the collection here. That will allow
// for the passing of context, handling of timeouts, and more control over the collection.
// The current NewProbeCollector() implementation relies on the MustNewConstMetric() call to create the metrics which is not