Skip to content

Commit

Permalink
Change MessageEventSubscriber logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Jan 19, 2023
1 parent c379517 commit bd2e12c
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Infrastructure/EventSubscriber/MessageEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

class MessageEventSubscriber implements EventSubscriberInterface
{
public const ALREADY_UPDATE_HEADER_KEY = 'mailer-bundle-update';

#[Required]
public BccEmailUpdater $bccEmailUpdater;

Expand All @@ -45,16 +43,10 @@ public function onMessage(MessageEvent $event): void
{
$message = $event->getMessage();

if (!$message instanceof Email) {
if (!$message instanceof Email || $event->isQueued()) {
return;
}

if ($message->getHeaders()->has(self::ALREADY_UPDATE_HEADER_KEY)) {
return;
}

$message->getHeaders()->addTextHeader(self::ALREADY_UPDATE_HEADER_KEY, 'true');

($this->bccEmailUpdater)($message);
($this->footerEmailUpdater)($message);
($this->returnPathEmailUpdater)($message);
Expand Down

0 comments on commit bd2e12c

Please sign in to comment.