diff --git a/api/main.go b/api/main.go index 6dbd5d2..b9d629c 100644 --- a/api/main.go +++ b/api/main.go @@ -178,10 +178,10 @@ func main() { log.Println("Server is shutting down...") // Graceful shutdown with 30 second timeout - ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() + shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 30*time.Second) + defer shutdownCancel() - if err := server.Shutdown(ctx); err != nil { + if err := server.Shutdown(shutdownCtx); err != nil { log.Fatalf("Server forced to shutdown: %v", err) }