Skip to content

Server: Allow second SIGINT / SIGTERM to force exit#31

Merged
swalkinshaw merged 1 commit intoroots:mainfrom
tangrufus:sig
Mar 18, 2026
Merged

Server: Allow second SIGINT / SIGTERM to force exit#31
swalkinshaw merged 1 commit intoroots:mainfrom
tangrufus:sig

Conversation

@tangrufus
Copy link
Member

Before:

  1. Boot the server
  2. Press Ctrl + C once to trigger graceful shutdown
  3. Press Ctrl + C again. This has no effect. You must wait for the server to shut down

After:

  1. Boot the server
  2. Press Ctrl + C once to trigger graceful shutdown
  3. Press Ctrl + C again to force exit immediately

Copilot AI review requested due to automatic review settings March 18, 2026 17:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the HTTP server shutdown flow to use a context-based signal notification mechanism instead of a dedicated signal channel, aligning shutdown triggering with context.Context cancellation semantics.

Changes:

  • Replaced signal.Notify + quit channel with signal.NotifyContext(...).
  • Updated shutdown logging to record a context-derived value on cancellation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

case sig := <-quit:
a.Logger.Info("shutting down", "signal", sig.String())
case <-sigCtx.Done():
a.Logger.Info("shutting down", "cause", context.Cause(sigCtx))
a.Logger.Info("shutting down", "signal", sig.String())
case <-sigCtx.Done():
a.Logger.Info("shutting down", "cause", context.Cause(sigCtx))
stop()
@tangrufus tangrufus changed the title Server: Allow second SIGINT & SIGTERM to force exit Server: Allow second SIGINT / SIGTERM to force exit Mar 18, 2026
Before:

1. Boot the server
2. Press `Ctrl + C` once to trigger graceful shutdown
3. Press `Ctrl + C` again. This has no effect. You
   must wait for the server to shut down

After:

1. Boot the server
2. Press `Ctrl + C` once to trigger graceful shutdown
3. Press `Ctrl + C` again to force exit immediately
@swalkinshaw swalkinshaw merged commit 513313f into roots:main Mar 18, 2026
6 checks passed
@tangrufus tangrufus deleted the sig branch March 19, 2026 20:23
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.

3 participants