GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: harden 'query.stream' against retriable exceptions by tseaver · Pull Request #456 · googleapis/python-firestore

This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Conversation

@tseaver

@tseaver tseaver commented Sep 23, 2021

Copy link
Copy Markdown
Contributor

Closes #223.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tseaver
fix: harden 'query.stream' against retriable exceptions
40f8aba
Closes #223.
@tseaver
tseaver requested review from a team and crwilcox 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
crwilcox
crwilcox reviewed Sep 23, 2021
View reviewed changes
Comment thread google/cloud/firestore_v1/query.py Outdated

while True:
try:
response = next(response_iterator)

@crwilcox crwilcox Sep 23, 2021

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tseaver tseaver Sep 23, 2021

Copy link
Copy Markdown
Contributor Author

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).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tseaver tseaver Sep 23, 2021

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@crwilcox
Merge branch 'main' into 223-retry-query-stream-iteration
3df5b86
@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
@tseaver
refactor: clarify error vs. end-of-iteration
40a65c9
crwilcox
crwilcox approved these changes Sep 23, 2021
View reviewed changes
@tseaver
tseaver merged commit 0dca32f into main Sep 23, 2021
@tseaver
tseaver deleted the 223-retry-query-stream-iteration branch September 23, 2021 22:05
@tseaver tseaver mentioned this pull request Sep 24, 2021
tests: add explicit unit tests for '_StreamedResponseIterator' class googleapis/python-api-core#281
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@crwilcox crwilcox crwilcox approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: firestore Issues related to the googleapis/python-firestore API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Port query retry from Node, Java to Python

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@tseaver @crwilcox @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.