Retry a Flaky API Without Duplicates: Idempotency Keys
A plain retry loop put five duplicate orders into a stand-in system. One key fixed it.
Video #305 ยท Forward deployed engineer interviews
Steps in the video
Files
- erp.py (22 lines)
- run.py (14 lines)
- sync.py (30 lines)
Tested with
Python 3.12.15
What this does not show
The ERP is a stand-in class with a fixed failure pattern, not a real system. No network, no queue, and nothing survives a restart. The key only helps if the other system honours it.
Sources
Learning IT by Example.