You send a request that triggers an e-mail, a push notification, an SMS or a payment. The connection drops. You do not know whether the server received it. Do you send it again?
If you retry, you may send the message twice. If you don't, you may send it zero times. Over a network, the honest answer is that you must retry, so the real work is making a repeat harmless. This article covers the four places where duplicates come from and the pattern that closes each one: the HTTP boundary, the queue, the state change and the button.
Why retrying is not optional
A request can fail in three ways that look identical to the client: the request never arrived, it arrived and failed, or it arrived and succeeded but the response was lost. The client sees a timeout in all three. If your API sends something irreversible, "just retry" is a bug waiting for the third case, and "never retry" is an outage waiting for the first.
The fix is not smarter retries.…