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

Add documentation for close, and context manager for SubscriberClient #238

Closed
alonme opened this issue Nov 16, 2020 · 3 comments · Fixed by #254
Closed

Add documentation for close, and context manager for SubscriberClient #238

alonme opened this issue Nov 16, 2020 · 3 comments · Fixed by #254
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. type: docs Improvement to the documentation for an API.

Comments

@alonme
Copy link

alonme commented Nov 16, 2020

The code examples in googleapis.dev do not close the SubscriberClient, and the context manager for this class is not mentioned anywhere, opposed to documenatation in https://cloud.google.com/pubsub/docs/pull .

Not closing the client results in a resource leak, so i think it should be clear from the documentation.

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Nov 16, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Nov 17, 2020
@meredithslota meredithslota added type: docs Improvement to the documentation for an API. and removed triage me I really want to be triaged. labels Nov 18, 2020
@meredithslota meredithslota self-assigned this Dec 8, 2020
@meredithslota
Copy link
Contributor

@alonme Thank you for the report! Can you point me to where in googleapis.dev the code samples don't match? I took a quick look and couldn't find it. Generally, the code samples in cloud.google.com will be more thorough.

@alonme
Copy link
Author

alonme commented Dec 8, 2020

@meredithslota
The code examples in the following pages, create Subscriber instances, however they don't close them.

https://googleapis.dev/python/pubsub/latest/index.html
https://googleapis.dev/python/pubsub/latest/subscriber/index.html

the code examples in cloud.google.com explicitly state the reason why closing is important and use the context manager, which is totally missing from the googleapis.dev docs

@alonme
Copy link
Author

alonme commented Oct 27, 2022

@meredithslota @anguillanneuf

any chance this is also missing from the examples of PublisherClient ?

i see that it also has an exit method

def __exit__(self, type, value, traceback):

does this also create a resource leak?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants