[openstreetmap/openstreetmap-website] Lock note during status update to avoid race condition (PR #5053)
Andy Allan
notifications at github.com
Wed Aug 7 15:08:35 UTC 2024
@gravitystorm approved this pull request.
This looks good to me, but I defer to @tomhughes since he has more database expertise. He mentioned in the original issue that a transaction should be enough, but I don't think it's the case and I agree with @mmd-osm that a lock is necessary. Otherwise two transactions could run in parallel, both read the original status, be happy, and each add a comment without causing either transaction to fail.
I've checked the rails documentation and code, to make sure that the transaction will be rolled back (and therefore the lock released) if we raise errors ourselves.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5053#pullrequestreview-2225485808
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5053/review/2225485808 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240807/8942c6b1/attachment.htm>
More information about the rails-dev
mailing list