Repository navigation
fix(api): register NuQ RabbitMQ consumer before setting listener - #4263
edenbuilds wants to merge 4 commits into
Conversation
Move channel.consume() into the startListener try block and clear this.listener on failure so a consume() throw cannot leave a consumer-less channel that permanently trips the early-return guard and hangs every waitForJob (firecrawl#4244).
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Clearing the listener alone left half-open broker resources when channel.consume() failed. Close the channel and connection in the catch path so retries do not leak. Addresses cubic P2 on firecrawl#4263 / firecrawl#4244.
|
Addressed cubic P2: on |
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Reuse the shared AMQP close helper instead of swallowing every error with
.catch(() => {}), while still preserving the original consume failure.
|
Addressed cubic P3: consume-failure cleanup now uses |
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
Expected close log said "during shutdown" but the same helper also cleans half-open listeners after consume failures.
|
Also took the follow-up cubic P3 on the log wording: |
Continue firecrawl#4263 against current main and verify subscription recovery with RabbitMQ and Postgres. Co-authored-by: edenbuilds <[email protected]> Co-authored-by: omkar1work <[email protected]>
|
For anyone finding this older PR: the work continues against current main in #5923, with additional recovery and regression coverage. Thanks @JasonOA888 for carrying it forward. |
Summary
NuQ.startListener()setthis.listenerinsidetry/finally, then calledchannel.consume()outside that block.consume()threw, the early-return guard saw a truthy listener forever and never re-registered a consumer — everywaitForJob()hung until timeout.consume()into the try, only publishthis.listenerafter a successful consume, and clear it on failure.Fixes #4244
Test plan
channel.consume()throwing after connect/assertQueue; confirm a laterstartListener()retries instead of no-op'ing.waitForJob().Made with Cursor
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes a bug where
NuQcould set a listener without a consumer, causingwaitForJob()to hang. We now register theRabbitMQconsumer first, only setthis.listeneron success, and clean up withcloseAmqpResourceon failure; fixes #4244.channel.consume()intostartListener()and setthis.listeneronly after a successful consume;noAck: falseunchanged.closeAmqpResourceto prevent leaks and allow retries; centralizeonClosefor fast auto-retry; update its expected-close log to "already closing" for restart safety.Written for commit e2aef21. Summary will update on new commits.