Skip to content

v1.2.1 - Webhook Graceful Shutdown Fix

Choose a tag to compare

@777genius 777genius released this 14 Dec 13:37
· 297 commits to main since this release

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