Menu

The Retry After a Timeout Created Two Records Because the First POST Had Already Landed
📰

The Retry After a Timeout Created Two Records Because the First POST Had Already Landed

DEV Community: ai·Jeff·15 days ago
#fbmStsor
#devtoai#devto#dev#retry#call
Reading 0:00
15s threshold

The agent was asked to make a flaky outbound POST reliable, so it added an automatic retry on timeout: wait, re-send, stop after three attempts. The test suite mocked the server as always failing on the first call, passed the retry on the second, and reported green. In production the first POST had actually committed while the client was still waiting on a slow response, and the retry wrote a second record.

The core mistake is treating a timeout as proof that nothing happened. A timeout only proves the client did not hear a response back within its window. The server may have parsed, validated, stored, and responded just after the cutoff.

Three outcomes the client cannot see at the cutoff

At the timeout Server state likely Blind retry does

Request still queued, nothing committed Safe to retry Correct

Request committed, response in transit Unknown Likely duplicates

Request rejected after validation Safe to retry Correct

A synthetic retry fixture collapses all three into one: first call errors before…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.