<p>Looks fine to me - I'm happy with emails being delievered synchronously since the task is being done asynchronously.</p>
<p>It's a pity this problem wasn't picked up in the tests, but that's because there the jobs are run immediately. I could design some kind of state machine for this - only delete when pending notifications have been sent - but that seems cumbersome.</p>
<p>Thinking about it some more, we could redesign the Notifier.gpx_failure calls to take the data they need, rather than a trace object. See <a href="https://ricostacruz.com/til/rails-mailer-race-conditions" rel="nofollow">https://ricostacruz.com/til/rails-mailer-race-conditions</a> . But I'm not sure if it's worth the trade-off in this situation.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2313?email_source=notifications&email_token=AAK2OLLPJEU47GTSIINTLQTP7WR7LA5CNFSM4ID2UXJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2APFHA#issuecomment-511767196">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNFQ2N3RUNTXYVFUATP7WR7LANCNFSM4ID2UXJA">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAK2OLMOQ43MLQ7OOX2WRNTP7WR7LA5CNFSM4ID2UXJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2APFHA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2313?email_source=notifications\u0026email_token=AAK2OLLPJEU47GTSIINTLQTP7WR7LA5CNFSM4ID2UXJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2APFHA#issuecomment-511767196",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2313?email_source=notifications\u0026email_token=AAK2OLLPJEU47GTSIINTLQTP7WR7LA5CNFSM4ID2UXJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2APFHA#issuecomment-511767196",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>