Retries and idempotency

Seedling

May 1, 2025 1 min read

Retrying a failed request is a default reliability tactic, but it is only safe when the operation is idempotent - running it twice has the same effect as running it once.

When it is not, a retry after a timeout (where the first call actually succeeded) can create duplicate records or double charges. The fix is to make writes idempotent: an idempotency key the server deduplicates on, conditional writes, or upserts keyed by a stable id.