Retries and Error Handling

As a starting point, use these scripts to add production-grade reliability to your integration.

  • They show how to apply timeouts, bounded retries, and exponential backoff when requests fail due to transient errors or rate limits, while avoiding retries on non-recoverable failures such as invalid authentication or malformed requests.

  • With exponential backoff, each retry waits longer than the last, often with added jitter, which reduces contention and prevents synchronized retry storms.

  • Retries continue until the request succeeds or a maximum attempt limit is reached, allowing your system to recover gracefully without dropping work or violating rate limits.

  • Refer to these resources for more guidance:

    • https://tenacity.readthedocs.io/en/latest/

    • https://pypi.org/project/backoff/

Last updated

Was this helpful?