Ravi Sir's Cards › AWS
Compensation must be idempotent
This revision card explains Compensation must be idempotent. It starts from the need that retrying a refund twice can double-credit the customer. Every compensate handler must tolerate duplicate invokes safely. The how-to section notes key on sagaId+step , then conditional write , then treat dup as success. An example on the card is arjun Mehta fails interviews that skip idempotent compensations.
Read card text
What this card says
Why do we need it?
Retrying a refund twice can double-credit the customer.
What is it?
Every compensate handler must tolerate duplicate invokes safely.
idempotent
How to do it
Key on sagaId+step → conditional write → treat dup as success.
Example
Arjun Mehta fails interviews that skip idempotent compensations.