Fix duplicate EmailLog rows for a single sent email
Mailer dispatches MessageEvent twice when routed through Messenger: once when queuing (queued=true) and once on the actual send from the worker (queued=false). EmailLoggerListener logged on both, creating two rows per email actually sent. Skip the queued dispatch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,10 @@ class EmailLoggerListener
|
|||||||
|
|
||||||
public function onMessage(MessageEvent $event): void
|
public function onMessage(MessageEvent $event): void
|
||||||
{
|
{
|
||||||
|
if ($event->isQueued()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$message = $event->getMessage();
|
$message = $event->getMessage();
|
||||||
if (!$message instanceof TemplatedEmail) {
|
if (!$message instanceof TemplatedEmail) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user