Skip to content

Handle channel close and consumer cancel cases#8

Merged
smithamax merged 2 commits intomasterfrom
feature/fix-channel-close
Apr 22, 2025
Merged

Handle channel close and consumer cancel cases#8
smithamax merged 2 commits intomasterfrom
feature/fix-channel-close

Conversation

@smithamax
Copy link
Copy Markdown
Member

@smithamax smithamax commented Apr 17, 2025

Previously if the channel was canceled or the queue consumer was canceled we just hung not doing anything

Now we exit the handleQueue, letting the caller re-run handleQueue if needed

Previously if the channel was canceled or the queue consumer was
canceled we just hung not doing anything

Now we exit the handleQueue, letting the caller re-run handleQueue if
needed
@smithamax smithamax self-assigned this Apr 17, 2025
@smithamax smithamax requested a review from J-tt April 17, 2025 01:13
Copy link
Copy Markdown
Contributor

@J-tt J-tt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good, just had some questions around the sample code for using the library, but happy to touch on that in a follow up

const doneP = (async () => {
// We loop here in case the rabbit channel closes and we need to restart
// the queue handler.
while (!aborter.signal.aborted) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to include a sleep interval or a retry limit in the sample code here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine without

// In this example we update a cache with the latest value from the queue.
// If we loose our our connection to the queue, we need to clear the cache
// and start again.
while (!aborter.signal.aborted) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question around retry limits / sleeps in the loop as the other comment

Co-authored-by: Jett Jackson <jett.jackson@loke.com.au>
@smithamax smithamax requested a review from J-tt April 22, 2025 01:11
@smithamax smithamax merged commit bd4a94a into master Apr 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants