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

Where is the best place to clean/refresh resources after queued jobs are handled? #16739

Closed
halaei opened this issue Dec 10, 2016 · 2 comments
Closed

Comments

@halaei
Copy link
Contributor

halaei commented Dec 10, 2016

Running queue:work command, I want to be sure that all the resources are clean and healthy before handling the next job. For example, I would like to rollback or reconnect the DB connection if the previous job was not successful in closing the transaction.

I was thinking to listen to Events\JobProcessing event. However, this event is also fired when pushing a job to a 'sync' queue, and I don't want to reset the DB connection every time I push a job to a 'sync' queue.

@sisve
Copy link
Contributor

sisve commented Dec 10, 2016

It sounds like you want to run the queue without the daemon mode. Running queue:work --once will only execute one job and then quit; this will close down all resources and database connections (as php scripts do at the end of execution). Running queue:listen will call queue:work --once repeatedly.

@halaei
Copy link
Contributor Author

halaei commented Dec 11, 2016

I am already aware of that option. However, queue:listen is not efficient enough for my use-case, because of the fork overhead, plus the unnecessary overhead of resetting all the remote connections, when there is no need to.

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

No branches or pull requests

3 participants