Idempotence

What is idempotence?

Idempotence is the property of certain operations in mathematics and computer science that can be applied multiple times without changing the result beyond the initial application

5bc84754.png

Get charget multiple times

cd8bc68e.png

client request -> service A. If service A response on time, there is no problem But what if that service doesn't reply in a specific time, client keep retrying and make post request. So the backend must implement idempotency

Solution1 : Client create oder ID and request the same ID if the request failed

Solution 2: Hashing the content of the request

Avoid Replica databases, stick to master

A duplicate payment created as a result from replica lag

a88b2e3b.png

Duplicate payment avoided by storing idempotency information only on master

9fee8ae0.png

Handling Exceptions โ€” To Retry or Not to Retry?

b680ee47.png

References

https://medium.com/airbnb-engineering/avoiding-double-payments-in-a-distributed-payments-system-2981f6b070bb

Last updated on