Skip to content

feat(pubsub): add stop method - #9365

Merged
pradn merged 15 commits into
googleapis:masterfrom
MaxxleLLC:pubsub_wait_method
Nov 7, 2019
Merged

feat(pubsub): add stop method#9365
pradn merged 15 commits into
googleapis:masterfrom
MaxxleLLC:pubsub_wait_method

Conversation

@IlyaFaer

Copy link
Copy Markdown

Add stop() method, which sends all outstanding messages and waits until all futures resolved. Similar features in Go and Java.

Closes#4913
Closes#6883

@IlyaFaerIlyaFaer added the api: pubsub Issues related to the Pub/Sub API. label Oct 1, 2019
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 1, 2019
@IlyaFaerIlyaFaer added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated
Comment threadpubsub/google/cloud/pubsub_v1/futures.py
@IlyaFaer
IlyaFaer marked this pull request as ready for review October 1, 2019 09:38
@IlyaFaer
IlyaFaer requested a review from plamut as a code ownerOctober 1, 2019 09:38
@pradn
pradn self-requested a review October 2, 2019 16:31
@googleapisgoogleapis deleted a comment from tseaverOct 4, 2019
Comment threadpubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py Outdated
Comment threadpubsub/google/cloud/pubsub_v1/publisher/_batch/thread.py
Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated

@pradnpradn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.

@IlyaFaer

Copy link
Copy Markdown
Author

How about:
to make sure all publish requests completed, either in success or error.

No problem, pushed

Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated
Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated
Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py
@IlyaFaer

Copy link
Copy Markdown
Author

@pradn, thanks for leading me through
@kamalaboulhosn, well, it's now more close to what you proposed. Do you have any more comments? Or we could merge, I think

@plamutplamut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, including the locking (the code is also easier to reason about with the _batch_lock spanning across the entire bodies of the publish/stop methods).

Suggested two small improvements, if it's not too late (had to prioritize other stuff, apologies).

Edit: To clarify, this PR can be merged as-is if it's blocking other @pradn's work, and the suggested changes, if accepted, can be added separately.

Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated
Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py
@kamalaboulhosn

Copy link
Copy Markdown
Contributor

@pradn, thanks for leading me through
@kamalaboulhosn, well, it's now more close to what you proposed. Do you have any more comments? Or we could merge, I think

Works for me, thanks!

Comment threadpubsub/google/cloud/pubsub_v1/publisher/client.py Outdated
Co-Authored-By: Peter Lamut <plamut@users.noreply.github.com>

@plamutplamut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks for the quick changes!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsubIssues related to the Pub/Sub API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pubsub: How to flush unsent messages on program exit? Pubsub API should provide a way to synchronize a set of operations

7 participants

@IlyaFaer@kamalaboulhosn@tseaver@pradn@plamut@googlebot@yoshi-kokoro