Skip to content

Built-in retry/backoff for transient gateway 5xx in API.send_request #139

Description

@martinkersner

Problem

tests/conftest.py wraps API.send_request to retry 502/503/504 because the prod edge "intermittently returns these under load — infra flakiness, not an SDK bug." That retry exists only in the test suite, so real consumers hit the same transient 5xx and get a ServerError on the first blip, with no handling.

Proposal

Move bounded retry-with-backoff into datamaxi/api.py::API.send_request (or _dispatch_request):

  • Retry a small, configurable set of transient statuses (default 502, 503, 504) and connection/read timeouts.
  • Linear or exponential backoff, capped attempts (e.g. 3).
  • Opt-out / tunable via constructor kwargs (e.g. max_retries=, retry_statuses=).
  • Non-transient 4xx/5xx still raise immediately.

Notes

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions