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

Implement Poller that retries endpoints when encountering some pre-specified Atlas API errors #110

Open
prashantmital opened this issue Mar 11, 2021 · 0 comments

Comments

@prashantmital
Copy link
Contributor

In several places we are doing something like:

timer.start()

while True:
    try:
        # do stuff
    except AtlasApiError as exc:
        if exc.error_code not in [List of error codes to retry on]:
            raise
        sleep(...)
        continue
    else:
        # we did what we needed to do, exit
        break
    finally:
        if timer.elapsed > MAX_WAIT:
            raise Exception('unable to do stuff')

We should create a concrete subclass of PollerBase

class PollerBase:
that is tailormade for this purpose.

@prashantmital prashantmital changed the title Implement Pollers that retry endpoints when specific errors are seen Implement Poller that retries endpoints when encountering some pre-specified Atlas API errors Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant