<p></p>
<blockquote>
<ul dir="auto">
<li><code class="notranslate">Note</code> has a field <code class="notranslate">open=true (default)</code></li>
</ul>
</blockquote>
<p dir="auto">Notes already have a <code class="notranslate">closed_at</code> field.</p>
<blockquote>
<ul dir="auto">
<li><code class="notranslate">NoteComment</code> has a field <code class="notranslate">action=null (default)|close|reopen</code></li>
</ul>
</blockquote>
<p dir="auto">NoteComments already have an <code class="notranslate">event</code> field.</p>
<blockquote>
<ul dir="auto">
<li>Whenever a comment is saved, a hook is triggered that updates the <code class="notranslate">Note.open</code> flag.</li>
</ul>
</blockquote>
<p dir="auto">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.</p>
<blockquote>
<ul dir="auto">
<li><em>or</em> is there a Queuing system in place</li>
</ul>
</blockquote>
<p dir="auto">Yes, we use ActiveJob both for the <a href="https://github.com/openstreetmap/openstreetmap-website/tree/682201d8f43bdb1fb9b85e3383bf6208f023a73b/app/jobs">jobs defined in app/jobs</a> and also for other features like ActionMailer's <code class="notranslate">.deliver_later</code></p>
<p dir="auto">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).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/3831#issuecomment-1748409194">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMKBPXMT2NQWFHXC2DX5ZYOVAVCNFSM6AAAAAASXEX646VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYGQYDSMJZGQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLN3YJFMJ2GWNL256HDX5ZYOVA5CNFSM6AAAAAASXEX646WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTIG2NWU.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/3831/1748409194</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/3831#issuecomment-1748409194",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3831#issuecomment-1748409194",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>