From 36824046fb9d8245d951f3264a5e20db8b58898b Mon Sep 17 00:00:00 2001 From: clawbot Date: Sun, 1 Mar 2026 16:35:55 -0800 Subject: [PATCH] fix: remove double cleanShutdown call (closes #21) The serve() method called cleanShutdown() after ctx.Done(), and the fx OnStop hook also called cleanShutdown(). Remove the call in serve() so shutdown happens exactly once via the fx lifecycle. --- internal/server/server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/server/server.go b/internal/server/server.go index a3aba0c..1aa30d7 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -109,7 +109,7 @@ func (s *Server) serve() int { s.log.Info("signal received", "signal", sig.String()) if s.cancelFunc != nil { // cancelling the main context will trigger a clean - // shutdown. + // shutdown via the fx OnStop hook. s.cancelFunc() } }() @@ -117,7 +117,8 @@ func (s *Server) serve() int { go s.serveUntilShutdown() <-s.ctx.Done() - s.cleanShutdown() + // Shutdown is handled by the fx OnStop hook (cleanShutdown). + // Do not call cleanShutdown() here to avoid a double invocation. return s.exitCode }