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

fix: shutdown error on streaming pull callback error #40

Merged
merged 2 commits into from Feb 28, 2020

Conversation

@plamut
Copy link
Contributor

@plamut plamut commented Feb 28, 2020

Fixes #39.

This PR fixes an error that can happen if cancelling a streaming pull future when the streaming pull manager has already been shut down due to the error in the user callback.

How to test

  • Have a topic and a subscription, publish at least one message to the topic.
  • Take the basic streaming pull sample from the docs.
  • Adjust the message received callback to raise an exception

Actual result (before the fix):
An error occurs during the shutdown:

RuntimeError: set_result can only be called once.

Expected result (after the fix):
No internal error occurs during the shutdown, except for the error from the user callback, as expected.

PR checklist

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
@plamut plamut requested a review from pradn Feb 28, 2020
tests/unit/pubsub_v1/subscriber/test_futures_subscriber.py Outdated Show resolved Hide resolved
Loading
@plamut plamut requested a review from pradn Feb 28, 2020
pradn
pradn approved these changes Feb 28, 2020
@pradn pradn merged commit 552539e into googleapis:master Feb 28, 2020
3 checks passed
Loading
@plamut plamut deleted the iss-39 branch Feb 28, 2020
gcf-merge-on-green bot pushed a commit that referenced this issue Feb 28, 2020
🤖 I have created a release \*beep\* \*boop\* 
---
### [1.3.1](https://www.github.com/googleapis/python-pubsub/compare/v1.3.0...v1.3.1) (2020-02-28)


### Bug Fixes

* shutdown error on streaming pull callback error ([#40](https://www.github.com/googleapis/python-pubsub/issues/40)) ([552539e](https://www.github.com/googleapis/python-pubsub/commit/552539e7beb30833c39dd29bfcb0183a07895f97))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants