fix: await processEvent before acking RabbitMQ message to restore backpressure#490
Merged
Uxio0 merged 1 commit intoApr 14, 2026
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f750555468
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…kpressure Unawaited func() caused channel.ack() to fire synchronously before any HTTP requests were made, making AMQP_PREFETCH_MESSAGES completely ineffective and creating unbounded concurrent connections under load.
f750555 to
20669a6
Compare
falvaradorodriguez
approved these changes
Apr 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
subscribeToEventscallback was notasyncand did notawait func(), causingchannel.ack()to fire before any HTTP requests were madeAMQP_PREFETCH_MESSAGEScompletely ineffective — every message was acked instantly, regardless of delivery statusFix
Made the consume callback
async,awaitsfunc(), and only acks infinally. Errors are caught and logged; always ack (no requeue — HTTP-level retries are the right layer for transient failures).Follow-up
Increase
AMQP_PREFETCH_MESSAGESfrom 10 to 100. With the fix applied, prefetch is the real concurrency dial:throughput = prefetch / avg_webhook_latency. At 100 prefetch × 10 webhooks = 1,000 concurrent HTTP connections at steady state, sustaining ~189 events/sec with avg webhook latency under ~530ms.Closes PLA-1250