github 777genius/claude-notifications-go v1.2.1
v1.2.1 - Webhook Graceful Shutdown Fix

latest releases: v1.40.1, v1.40.0, v1.39.4...
8 months ago

Fixed

  • Webhook notifications never sent (#6)
    • Shutdown() now waits for in-flight HTTP requests to complete before exit
    • Added defer webhookSvc.Shutdown(5s) to HandleHook() for graceful shutdown
    • Previously: cancel() was called immediately, interrupting HTTP requests
    • Now: cancel() is only called after completion or on timeout

Added

  • E2E test TestE2E_WebhookGracefulShutdown - deterministic graceful shutdown verification
  • Unit tests for Shutdown() + SendAsync() combination
  • Updated webhookInterface to include Shutdown(timeout) method

Technical Details

The root cause was that Shutdown() called s.cancel() immediately, which cancelled the context used by HTTP requests. This caused webhook requests to be interrupted before they could complete.

The fix moves cancel() to be called only:

  1. After all in-flight requests complete successfully, OR
  2. When the shutdown timeout (5 seconds) is reached

This ensures webhook notifications are reliably delivered before the process exits.


Fixes #6

Don't miss a new claude-notifications-go release

NewReleases is sending notifications on new releases.