Idempotency for aiohttp servers (and why client retries need it) #13337
violetta98
started this conversation in
Show and tell
Replies: 1 comment
|
If you're offering idempotency, then you shouldn't be using POST to start with. I also don't see any example using aiohttp, so not sure why you're posting here? Even the example above looks like it may be for FastAPI, not aiohttp... |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone!
Sharing a library and a gotcha that cuts both ways.
On the client side: if you retry a POST, generate the
Idempotency-Keyonce outside the retry loop. Generate it per attempt and the server sees a fresh request every time, which defeats the point.On the server side: honouring that key is harder than it looks. The obvious version checks whether the key exists and then stores it, and those are two steps, so two retries landing together can both pass the check.
Same
order_idruns once. A second request arriving while the first is still going waits and gets its result rather than an error.https://github.com/idemkit/idemkit, Apache-2.0, async-native, zero-dependency core.
If it's useful, a star would really help, it's a new project.
All reactions