-
Notifications
You must be signed in to change notification settings - Fork 50
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
Adjust channel and connection on close callbacks to pika 0.12 #78
Adjust channel and connection on close callbacks to pika 0.12 #78
Conversation
Signed-off-by: Sebastian Wojciechowski <s.wojciechowski89@gmail.com>
Signed-off-by: Sebastian Wojciechowski <s.wojciechowski89@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
=========================================
+ Coverage 95.67% 97.1% +1.43%
=========================================
Files 11 11
Lines 809 795 -14
Branches 114 110 -4
=========================================
- Hits 774 772 -2
+ Misses 20 12 -8
+ Partials 15 11 -4
Continue to review full report at Codecov.
|
""" | ||
Callback invoked when the channel is closed. | ||
|
||
Args: | ||
channel (pika.channel.Channel): The channel that got closed. | ||
reply_code_or_reason (int|Exception): The reason why the channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In pika-1.0.0 (not yet released), it's an exception, so this code handles the upcoming API change. The fact that our CI didn't catch this is an issue, though!
It's hard to write a reasonable unit test to cover this, but I think an integration test would be easy(ish) to write. I've documented what probably needs to happen in #79.
See the in-line comment about why we can't remove this. It is wrong that the tests passed, though, so thanks for this! I think we can write some good tests to exercise this code instead. |
I agree. |
From:
https://pika.readthedocs.io/en/stable/modules/connection.html#pika.connection.Connection.add_on_close_callback
Info:
The callback will be passed the connection, the reply_code (int) and the reply_text (str), if sent by the remote server
Can I assume that all of them (connection, the reply_code, the reply_text) remote server can skip, or just reply_text?