Idempotency middleware for Django Ninja (works out of the box, it's plain ASGI) #1750
violetta98
started this conversation in
Show and tell
Replies: 0 comments
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.
Hello everyone!
I got tired of rewriting idempotency in every service and getting it slightly wrong, so I packaged it. Posting here because Django Ninja is ASGI, so this drops in without anything Ninja-specific:
A client retrying a POST with the same
Idempotency-Keygets the first response back and your handler doesn't run again. Two identical requests at once: one runs, the other waits for its result instead of erroring.The Django packages in this space are all built on classic WSGI middleware, which is why none of them work here. This one has an ASGI path, so Ninja users aren't stuck writing their own.
It also can run with Postgres, Mongo, DynamoDB, so no need to add Redis just for this.
https://github.com/idemkit/idemkit, Apache-2.0
If it's useful, I'd appreciate a star. It's new, so visibility helps a lot right now.
All reactions