← Back to team overview

maas-devel team mailing list archive

idempotent()

 

Following on from the discussion about idempotent() on
https://code.launchpad.net/~rvb/maas/bulk-add-networks-to-node/+merge/206708:

An idempotent update could be submitted multiple times, and the state
would not change after the first submission.

If that holds, why not do it as a GET request? It's harmless to submit
multiple times? No. If the state changes between submissions, in
response to a separate event, a subsequent submission of that
idempotent POST might well have an effect beyond what we intended.

I don't know if that means it still qualifies as idempotent or not,
but something I think we'd like to avoid is user agents resubmitting
the original request without asking the user, for example. In other
words, although we consider it idempotent, we want to use POST so that
user agents do the Right Thing.

Put another way, I think some of the things we thing of as idempotent
are, in the real world of HTTP and multiple users and concurrency, not
practically idempotent.

Even though I was the one who dreamt it up, I have no special love for
the idempotent() decorator, and it's always felt imperfect. Can we
come up with a compelling improvement that better conveys semantics
over mechanics?


Follow ups