Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

[BUG#107] Ensure block should close connection only if using blocking subscription #108

Closed
wants to merge 1 commit into from

Conversation

laser
Copy link

@laser laser commented Jul 27, 2021

Problem

If the subscription was created in a non-blocking fashion, this ensure block will be hit before the receiver was returned, rending the receiver unusable. See #107 for more information.

Solution

The ensure block should close the underlying connection only if the subscription blocked (because the asynchronously-delivered Interrupt would cause Bunny::Queue#subscribe to unwind). Subscriptions created in a non-blocking fashion should allow callers to handle signal trapping and connection teardown themselves.

If the subscription was created in a non-blocking fashion, this ensure block will be hit before the receiver was returned, rending the receiver unusable.
@laser laser requested a review from a team as a code owner July 27, 2021 21:06
Comment on lines +51 to +57
# If the subscription was created in a non-blocking fashion, do not
# close the underlying connection before returning (or the receiver
# will not be usable).
#
# For more information, see here:
#
# https://github.com/stitchfix/pwwka/issues/107
Copy link

Choose a reason for hiding this comment

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

Is there a way we can express this comment as a test?

@benortiz benortiz changed the base branch from master to main September 17, 2021 21:16
@benortiz benortiz closed this Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants