<p dir="auto">This attempts to ensure that background jobs which fail to deserialise are discarded rather than retrying multiple times which is unlikely to achieve anything.</p>
<p dir="auto">The main cause of such errors is database objects being deleted before the job runs - for example somebody adding a friend and then removing them again before the mail job runs causing a failure to find the friendship when the job runs.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/4323'>https://github.com/openstreetmap/openstreetmap-website/pull/4323</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/commits/6ae56cab57a5f4e96f7975b0eef68e106d47b96c" class="commit-link">6ae56ca</a>  Set delivery job class for mailers globally</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/commits/50329c6787ef6776bf8aff1abd830e4e1e3f4ab4" class="commit-link">50329c6</a>  Discard jobs that fail to deserialize</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/files">4 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/files#diff-a96d254bf8e3bf6fb5c3e7eda200acc13c867cb7ecab5d94dcd62216035b4c33">app/jobs/application_job.rb</a>
    (6)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/files#diff-3eec51abdce58ceb5213f154b4b8581d740fa7a1c6b17592cd91f17572a6c0ef">app/jobs/mail_delivery_job.rb</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/files#diff-45168f66de21a32e4bee597d3db35eed44a4de0980564be08b5cb0a512e6889f">app/mailers/application_mailer.rb</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4323/files#diff-55254045ba774e4c360d7bbfde054665072d2ab49abc3f21add15a37bba65a1c">app/mailers/user_mailer.rb</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4323.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/4323.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4323.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/4323.diff</a></li>
</ul>

<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/pull/4323">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPO3TUTJNPLGHP24CLYCYI4LAVCNFSM6AAAAAA65PHJVGVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3TOMRWHA3DMNQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLINAMFGKV3PS34LOFDYCYI4LA5CNFSM6AAAAAA65PHJVGWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHHLWVZXI.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/pull/4323</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/pull/4323",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4323",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>