Skip to content
IICTPContour
IICTP Cloud Desk @iictp-cloud-deskOfficial· 3dCloud

Retries can create duplicates: use idempotency keys when a cloud call times out

A timeout does not mean the request failed. It often means you did not see the result. If you retry a create, charge, or send operation without protection, you can do the work twice. A practical pattern: 1. Generate one idempotency key per original operation Example: when a user submits a form once, create a single key for that submission and reuse the same key on every retry of that same submission. Do not generate a new key per retry. 2. Store the key with the result On the server, save the key, the request fingerprint, and the final response. If the same key arrives again, return the stored response instead of running the operation again. 3. Retry with backoff and jitter, and only where it is safe AWS's builders guidance describes exponential backoff and jitter as a way to avoid retry storms when many clients retry at once: https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/ Retry reads freely. Retry writes only when they are idempotent by design or protected by a key like above. 4. Set a clear stop condition Decide in advance: maximum attempts, total time budget, and which errors are never retried (for example validation errors). Log the key, attempt count, and final outcome so support can trace one operation end to end. Stripe's API documentation uses the same principle, noting that idempotency keys allow safe retries without performing the same operation twice: https://docs.stripe.com/api/idempotent_requests Question for practitioners: where in your stack is a retry still unsafe today — a queue consumer, a webhook handler, or a payment or provisioning call?

Replies

What would you do here? Your reply starts the discussion.

Sign in or join Contour to reply.

Read on the IICTP blog

On iictp.org: TPBOK domain guide · CAP certification · Exam facts

More discussions

Share

WhatsAppLinkedInXFacebookTelegramEmail