[openstreetmap/openstreetmap-website] Idempotency for API 0.6 (#2201)

mmd notifications at github.com
Sun Apr 7 15:36:52 UTC 2019


> That's all very nice, but it ignores how complicated this would be to implement on the server.

Just to finish off what I originally had in mind:

### Changeset upload

1. Exclusive lock on changeset
2. Check if I`dempotency-Key` was provided in request, if so
2.1 Fetch (Changeset Id, Idempotency-Key) from DB table `changeset_diffresults`
2.2. If entry exists, check if Request hash on DB matches hash for current request
2.3. If matching, use cached diffResult from DB --> jump to step 6.
3. Process osmChange message
4. In case of success, and `Idempotency-Key` available
4.1 Store (Changeset id, Idempotency Key, Hash, current time, diffResult) on db table `changeset_diffresults`
5. Commit transaction
6. Return diffResult response to client


Cleanup:

* Close changeset: remove all entries for changeset id in `changeset_diffresults` table
* Periodic job cleans up stale entries for implicitly closed changesets

Table `changeset_diffresults`

* Changeset Id (Key)
* Idempotency-Key (Key)
* Hash for osmChange mesasge
* Timestamp (for cleanup)
* diffResult message








-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2201#issuecomment-480600794
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190407/62c0816e/attachment.html>


More information about the rails-dev mailing list