-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Mailer] Prevent MessageLoggerListener from leaking in env=prod #37712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mailer] Prevent MessageLoggerListener from leaking in env=prod #37712
Conversation
|
What's the problem keeping it in prod (now that it does not leak memory anymore)? |
|
At first I had a hypothesis that If that's not the case, then why it is there when no other service depends on it? Obviously DI cannot automatically remove And yes, it's still leaking without calling I also found a comment by @nicolas-grekas :
This PR can help to accomplish this goal 😉 |
|
Not using something in core does not mean that we should remove it. |
|
(please mind the test failure) |
dadb3fb to
e226775
Compare
|
Thank you @vudaltsov. |
|
@fabpot , should I add a changelog entry? |
I was trying to send a batch of emails with
--env=prodwhen I noticed thatMessageLoggerListenerwas still collecting all the messages and leaking the memory. I tried to do$this->getApplication()->reset(), but it didn't work becauseMessageLoggerListenerwas not tagged (now fixed in #37705).In this PR I propose to move the declaration of
MessageLoggerListenertomailer_debug.phpsince the only service depending on it ismailer.data_collectorfrommailer_debug.php. If a developer needs to collect sent emails, a custom listener could be implemented on the project side.mailer_debug.php