fix(admin): release notification claim on dispatch failure so retries aren't blocked

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 16:17:44 +02:00
parent ab5ba2b169
commit 62b4d85ef7
1 changed files with 15 additions and 3 deletions

View File

@ -204,11 +204,23 @@ class Maintenance extends Component
return;
}
// Claim the row, then dispatch. If dispatch fails, release the claim
// immediately (delete if we created it, else restore the prior attempt
// time) so a resend can retry right away instead of waiting out the TTL.
$wasNew = $delivery->wasRecentlyCreated;
$priorUpdatedAt = $delivery->updated_at;
$delivery->forceFill(['updated_at' => now()])->save();
$mail->notificationId = $delivery->id;
Mail::to($customer->email)
->locale($customer->locale ?: config('app.locale'))
->queue($mail);
try {
Mail::to($customer->email)
->locale($customer->locale ?: config('app.locale'))
->queue($mail);
} catch (\Throwable $e) {
$wasNew ? $delivery->delete() : $delivery->forceFill(['updated_at' => $priorUpdatedAt])->save();
throw $e;
}
}
public function render()