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

retry_async does not follow the timeout duration #519

Closed
andrewsg opened this issue Aug 27, 2020 · 0 comments · Fixed by #520
Closed

retry_async does not follow the timeout duration #519

andrewsg opened this issue Aug 27, 2020 · 0 comments · Fixed by #520
Assignees
Labels
api: datastore Issues related to the googleapis/python-ndb API.

Comments

@andrewsg
Copy link
Contributor

(Imported from another source): rpc_call is wrapped by retry_async (_retry.py L26), but it seems that it does not follow the durations sleep_generator provided. By tracing the flow, this block (tasklets.py L260) might be the root cause of why there is almost no delay between retries.

The yielded tasklets.sleep is always suppressed because there is no assignment at the line self.generator.throw if the previous rpc call raises exception. I monkey-patched the block as

if error:
    try:
        traceback = error.__traceback__
    except AttributeError:  # pragma: NO PY3 COVER  # pragma: NO BRANCH  # noqa: E501
        traceback = None
    yielded = self.generator.throw(type(error), error, traceback)
else:
    # send_value will be None if this is the first time
    yielded = self.generator.send(send_value)

and the retry sleep would work.

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-ndb API. label Aug 27, 2020
chrisrossi pushed a commit to chrisrossi/python-ndb that referenced this issue Aug 27, 2020
chrisrossi pushed a commit that referenced this issue Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/python-ndb API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants