Skip to content

Fix shutdown issue and logging in HTTPServer#51

Merged
pior merged 1 commit intomasterfrom
httpserver
Feb 8, 2026
Merged

Fix shutdown issue and logging in HTTPServer#51
pior merged 1 commit intomasterfrom
httpserver

Conversation

@pior
Copy link
Copy Markdown
Owner

@pior pior commented Feb 8, 2026

  • Configurable shutdown timeoutHTTPServer now returns *httpServer (still satisfies Runnable) with a fluent API: .Name(string) and .ShutdownTimeout(time.Duration). The shutdown timeout was previously hardcoded at 30s.
  • Fix unnecessary Shutdown call — When ListenAndServe fails on its own (e.g. port in use), the code no longer calls Shutdown on an already-dead server.
  • Clearer log messages — Graceful shutdown now logs "shutting down""stopped" (matching the manager's pattern). Server errors log "stopped with error" instead of the ambiguous "shutdown".
  • Real unit tests — Added tests for graceful shutdown, listen error, pre-cancelled context, and fluent API configuration. Kept existing example tests.
  • Updated README example logs to match actual output.

Base automatically changed from readme to master February 8, 2026 10:54
@pior pior merged commit 283caf1 into master Feb 8, 2026
2 checks passed
@pior pior deleted the httpserver branch February 8, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant