[openstreetmap/openstreetmap-website] Lock note during status update to avoid race condition (PR #5053)

mmd notifications at github.com
Wed Aug 7 15:51:26 UTC 2024


> to make sure that the transaction will be rolled back 

Trying to reopen an open note (which is triggering an exception) immediately results a rollback. So this should work as expected:

```
  TRANSACTION (0.1ms)  BEGIN
  ↳ app/controllers/api/notes_controller.rb:208:in `block in reopen'
  Note Load (0.9ms)  SELECT "notes".* FROM "notes" WHERE "notes"."id" = $1 LIMIT $2 FOR UPDATE  [["id", 5], ["LIMIT", 1]]
  ↳ app/controllers/api/notes_controller.rb:208:in `block in reopen'
  TRANSACTION (0.2ms)  ROLLBACK
  ↳ app/controllers/api/notes_controller.rb:207:in `reopen'
```


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

Message ID: <openstreetmap/openstreetmap-website/pull/5053/c2273793159 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240807/733a1d21/attachment.htm>


More information about the rails-dev mailing list