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: harden 'query.stream' against retriable exceptions #456

Merged
merged 3 commits into from Sep 23, 2021

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Sep 23, 2021

Closes #223.

@tseaver tseaver requested a review from a team as a code owner September 23, 2021 19:07
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Sep 23, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 23, 2021

while True:
try:
response = next(response_iterator)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we inject this retry into __iter__ somehow? this seems more generally useful to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the underlying API call is a unary_stream, the response_iterator is an instance of google.api_core.grpc_helpers._StreamingResponseIterator: I guess we could modify its __next__ to do something like this (it is already tweaked to cache the first result, for instance).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see how we get the applicable retry object inside there -- the _wrapped attribute isn't our _GapicCallable, but something altogether different.

@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 23, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port query retry from Node, Java to Python
3 participants