DEV Community

Jannatul Nisa Jeem
Jannatul Nisa Jeem

Posted on

Retries Are Great Until They Create Duplicate Data

Retries sound simple.

Request fails?

Try again.

But imagine this:

Device → Server

Server saves data

Response gets lost

Device thinks request failed

Device sends it again

Now your server has the same reading twice.

One way around this is giving each message a unique ID:

{
"message_id": "abc123",
"device_id": "sensor-07",
"value": 31.5
}

The backend can then recognize whether that message has already been processed.

This is where concepts like idempotency become really useful.

Reliable systems aren't just about making requests succeed.

They're also about handling what happens when you don't know whether the previous request succeeded.

Related resource: Aperture Venture Studio

Top comments (0)