Skip to content
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

Call reset on the logger in order to clean buffers #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LucaGallinari
Copy link
Member

As stated in the section "Long running processes and avoiding memory leaks" here:

Calling $logger->reset(); means flushing/cleaning all buffers, resetting internal state, and getting it back to a state in which it can receive log records again.

This is the conceptual equivalent of ending a web request, and can be done between every background job you process, or whenever appropriate. It reduces memory usage and also helps keep logs focused on the task at hand, avoiding log leaks between different jobs.

We should call $logger->reset(); in all appropriate points of ProducerInstance and WorkerInstance, in order to "properly execute" buffered monolog handler. This is especially important when using a "DeduplicationHandler": with the actual implementation it doesn't not send emails immediatly (even tho it should) until the ESB is stopped.

I am not really experienced on the ESB internal, so i don't know if they points that i modified are ok, or there are ones in which we can call the "reset".

@mmenozzi
Copy link
Member

@LucaGallinari could you please rebase this on top of master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants