Skip to content

Commit

Permalink
bug #29837 Fix SwiftMailerHandler to support Monolog's latest reset f…
Browse files Browse the repository at this point in the history
…unctionality (Seldaek)

This PR was merged into the 3.4 branch.

Discussion
----------

Fix SwiftMailerHandler to support Monolog's latest reset functionality

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Monolog 1.24 added the ResettableInterface which is meant to support resetting handlers. Reset should also flush as if the request was ending, and it can be used for long running workers for example in between each job that is processed. Due to SwiftMailer's spool however the emails in case of errors are right now only sent at the very end of the worker's lifetime.

For older Monolog versions, this will be ignored, and is thus harmless.

Commits
-------

ada2d83 Fix SwiftMailerHandler to support Monolog's latest reset functionality
  • Loading branch information
fabpot committed Jan 13, 2019
2 parents b06967e + ada2d83 commit 3ea4901
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php
Expand Up @@ -59,6 +59,14 @@ protected function send($content, array $records)
}
}

/**
* {@inheritdoc}
*/
public function reset()
{
$this->flushMemorySpool();
}

/**
* Flushes the mail queue if a memory spool is used.
*/
Expand Down

0 comments on commit 3ea4901

Please sign in to comment.