Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle all channel opening within the lock #99

Merged
merged 2 commits into from
May 25, 2021
Merged

Handle all channel opening within the lock #99

merged 2 commits into from
May 25, 2021

Conversation

eandersson
Copy link
Owner

@eandersson eandersson commented May 24, 2021

Moved both the _cleanup_channel and return under the thread lock. We can't have the channel being cleaned up before the function return, as it will result in a KeyError, but we need to return a channel to not break the context manager.

Copy link
Collaborator

@jhogg jhogg left a comment

Choose a reason for hiding this comment

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

Looks good for the current conditions. My only concern, which we can roll to the 3.x work, is the LOGGER call is not deterministic and I don't like them inside lock()s unless absolutely necessary.

@eandersson
Copy link
Owner Author

Yea - the logger has bitten me before. I could just change it to

try:
<lock>
<do things>
<return>
finally:
<release lock>
<log message>

@eandersson
Copy link
Owner Author

eandersson commented May 25, 2021

An exception thrown in channel.open() will still result in a successful log message.

(Side question: Do you have a chat/discussion channel for amqpstorm other than issue tracking?)

Yea - not a lot we can do about that unfortunately without some larger changes. There are other log events as well, but I guess that most of those are on a separate thread.

Nvm. I see what you meant. Good catch.

I set a slack workspace up
https://join.slack.com/t/eandersson/shared_invite/zt-qy4nqk3l-A3ZYzrUPmkIoI4xRDLMojA

@jhogg
Copy link
Collaborator

jhogg commented May 25, 2021 via email

@eandersson eandersson merged commit e8f5c6f into 2.x May 25, 2021
@eandersson
Copy link
Owner Author

Sounds good. The email isn't showing up, but feel free to join the Slack workspace I set up.
https://join.slack.com/t/amqpstorm/shared_invite/zt-qy4nqk3l-A3ZYzrUPmkIoI4xRDLMojA

@eandersson eandersson deleted the bug/97_v2 branch August 29, 2021 18:53
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.

None yet

2 participants