[openstreetmap/openstreetmap-website] Lock changesets during a diff upload (PR #6379)

Tom Hughes notifications at github.com
Thu Sep 4 21:29:04 UTC 2025


tomhughes left a comment (openstreetmap/openstreetmap-website#6379)

Actually I think it's fine because `lock!` rereads the record (with `FOR UPDATE`) if it's not already part of a read so if `num_changes` has been changed in the database it will be updated at that point before we start incrementing it.

Possibly it would be better to move the transaction start earlier in the controller and take the lock as part of the find to avoid the re-read. It meant the diff object construction is inside the transaction but that's actually cheap as all the real work is in the `commit` method anyway.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6379#issuecomment-3255783891
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6379/c3255783891 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250904/aac6e161/attachment.htm>


More information about the rails-dev mailing list