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

Adjust channel and connection on close callbacks to pika 0.12 #78

Conversation

sebwoj
Copy link
Contributor

@sebwoj sebwoj commented Sep 22, 2018

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?

Signed-off-by: Sebastian Wojciechowski <s.wojciechowski89@gmail.com>
Signed-off-by: Sebastian Wojciechowski <s.wojciechowski89@gmail.com>
@sebwoj sebwoj requested a review from a team as a code owner September 22, 2018 20:06
@codecov-io
Copy link

codecov-io commented Sep 22, 2018

Codecov Report

Merging #78 into master will increase coverage by 1.43%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
fedora_messaging/_session.py 95.75% <100%> (+5.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a28f015...c88a57d. Read the comment docs.

"""
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
Copy link
Member

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.

@jeremycline
Copy link
Member

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.

@sebwoj sebwoj deleted the adjust_channel_and_connection_on_close_callbacks_to_pika-0.12 branch September 25, 2018 15:02
@sebwoj
Copy link
Contributor Author

sebwoj commented Sep 25, 2018

I agree.
I forgot to check development pika branch.
Now I see that api will change.
Thanks for clarification :)

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

3 participants