[openstreetmap/openstreetmap-website] What should we do about note comments? (Issue #3831)

Andy Allan notifications at github.com
Thu Oct 5 08:52:58 UTC 2023


> * `Note` has a field `open=true (default)`

Notes already have a `closed_at` field.

> * `NoteComment` has a field `action=null (default)|close|reopen`

NoteComments already have an `event` field.

> * Whenever a comment is saved, a hook is triggered that updates the `Note.open` flag.

The API has different endpoints for opening, closing and reopening notes, and the comment needs to be sent to the right one. There is, if you look very closely, a race condition in the code (e.g. checking for whether a note has been closed already is not done with a lock on the note) but in practice that hasn't been a big issue compared to all the other issues with notes.

> * _or_ is there a Queuing system in place

Yes, we use ActiveJob both for the [jobs defined in app/jobs](https://github.com/openstreetmap/openstreetmap-website/tree/682201d8f43bdb1fb9b85e3383bf6208f023a73b/app/jobs) and also for other features like ActionMailer's `.deliver_later`

But for something that is expected to happen instantaneously (e.g. updating a single record in the database) there's generally no need for a queue. Queuing is more useful for things that can take some time (e.g. processing 10,000 Tracepoint records) or interact with external services (e.g. delivering mail).

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

Message ID: <openstreetmap/openstreetmap-website/issues/3831/1748409194 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231005/8c998ff4/attachment-0001.htm>


More information about the rails-dev mailing list