-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow a zero time-limit for messenger:consume #44931
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
Conversation
Why don't you add |
@micheh that's a legitimate question. But to me, the PR still makes sense. |
Using only |
While I am fine with this PR, wouldn't time-limit=1 and limit=1 work for you? The usage of time-limit=0 could be confusing? Why not add an option --stop-immediately or sth more explanatory? |
Not to an engineer? ;) |
Thank you @fritzmg. |
By default
messenger:consume
will run indefinitely and as the docs mention you should monitor the process via Supervisor for example. However on shared hostings this is usually not an option and thus this command will be run via a cronjob there (at least I assume that's the intended best practise in such a case). To ensure the worker exits for each cronjob run, you can use the--time-limit
option, e.g.However, this would allow the worker to consume multiple message for the duration of 1000ms - so technically if you want the worker to immediately exit each time after it processed the current message queue it should actually be
But this does not currently work, as the zero is falsey and thus the
StopWorkerOnTimeLimitListener
will not actually be added.This PR fixes that by checking whether the option was actually supplied or not.