Hacker News new | past | comments | ask | show | jobs | submit login

Is this a typical definition of idempotency? One where you have to be idempotent even when another system is in play? I wouldn't expect anything to be idempotent if something else can come along and change arbitrary state.



No, it is not. Typically an operation is considered idempotent if you can perform it multiple times in a row, with no other intervening operations, and the result is the same as if you had only performed the operation once. I don't know what this person is trying to get at.


Usually I’ve seen it defined as that the intended effect happens at most once. e.g. see https://developer.mozilla.org/en-US/docs/Glossary/Idempotent


From your link:

> An HTTP method is idempotent if an identical request can be made once or several times in a row with the same effect while leaving the server in the same state.

Which is according to what OP wrote.

I wouldn't translate this into "the intended effect happens at most once", as that behavior includes the effect of the transport. "at most once", "at least once" and "exactly once" are messaging behaviors after all, and idempotency is a method to convert an "at least once"-messaging-effect into an "exactly once"-change-effect.


No REST endpoint is idempotent because I can go unplug all the servers.


Or the DNS could change and the endpoint could be called on another server

Or your authorization could change and you no longer have access to the resource.

Honestly I'm not sure what the author thinks idempotency is.


You're absolutely right, thank you! I've posted a correction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: