-
Notifications
You must be signed in to change notification settings - Fork 78
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
Conversation
google/cloud/firestore_v1/query.py
Outdated
|
||
while True: | ||
try: | ||
response = next(response_iterator) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
Closes #223.