fix(metrics): clear startPromise on stop() to allow restart

FIX: startPromise was never cleared after stop(), causing start()
to return the old resolved promise instead of creating a new server.

This broke any flow that stops and restarts metrics (config reloads, tests).

Now stop() clears startPromise, allowing proper server restart.
This commit is contained in:
Claude
2026-01-20 04:26:27 +00:00
parent 21b632592a
commit 33b44ff19d
+4
View File
@@ -1133,9 +1133,13 @@ export class MetricsServer {
/**
* Stop the metrics HTTP server
* FIX: Clears startPromise to allow restart after stop
*/
stop(): Promise<void> {
return new Promise((resolve) => {
// FIX: Clear cached promise so start() can be called again
this.startPromise = null
if (this.collectInterval) {
clearInterval(this.collectInterval)
this.collectInterval = null