Repository navigation
feat: add cancelConsumersOnSigterm option (DS-3369) - #92
Merged
Merged
Conversation
…onsumer cancel (DS-3369) Processes with their own SIGTERM hook that waits on messages from these queues (e.g. eip-redis PubSub draining throttled events through eip-rabbit Timer queues) hang until SIGKILL once the consumers are cancelled. On by default, so existing behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alse; list option under v5.11.x Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is backward-compatible, focused, documented, and adequately tested.
0 open findings
What changed in this PR
Adds an opt-out for automatic consumer cancellation on SIGTERM, preserving existing behavior by default.
Changes:
- Adds
cancelConsumersOnSigterm, defaulting totrue. - Tests the disabled-listener behavior.
- Documents shutdown behavior and configuration.
| File | Description |
|---|---|
ts/rabbit.ts |
Conditionally registers the SIGTERM handler. |
test/rabbit.test.ts |
Covers the opt-out behavior. |
README.md |
Documents the new option and shutdown guidance. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
nikosd23
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since 5.9.2,
Rabbitcancels every consumer it created onSIGTERM. That's the right default, but it breaks processes that have their ownSIGTERMhook which waits on messages from those queues.maestro is one (Workable/maestro#1196, DS-3369). eip-redis PubSub's
SIGTERMhook waits for every held throttled event to be processed before exiting. Those events only complete when an eip-rabbitTimermessage arrives on a queue created through thisRabbit. Once that consumer is cancelled the wait never ends, and the pod hangs until SIGKILL and drops the events.cancelConsumersOnSigterm, defaulttrue. Withfalse, theSIGTERMlistener isn't registered, which matches the behaviour before 5.9.2.close()works either way.Testing
npm teston RabbitMQ 4.2.1: lint passes, 124 tests pass.SIGTERMlistener is added and a queue's consumer isn't unsubscribed. The existing tests cover the default path, where the listener is registered, removed onclose(), and unsubscribes every queue.Notes
Rabbitinstance. Withfalse, every queue keeps consuming until the app closes the connection. That's how maestro behaved before 5.9.2. A per-queue exemption, or a publiccancelConsumers()the app calls after its own drain, would be more precise. I left those out to keep this small.🤖 Generated with Claude Code