Allow a zero time-limit for messenger:consume#44931
Merged
Merged
Conversation
Contributor
|
Why don't you add |
stof
approved these changes
Jan 6, 2022
Member
|
@micheh that's a legitimate question. But to me, the PR still makes sense. |
Contributor
Author
Using only |
Contributor
|
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? |
Contributor
Author
Not to an engineer? ;) |
GromNaN
approved these changes
Jan 8, 2022
chalasr
approved these changes
Jan 8, 2022
Member
|
Thank you @fritzmg. |
This was referenced Jan 28, 2022
Merged
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default
messenger:consumewill 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-limitoption, 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
StopWorkerOnTimeLimitListenerwill not actually be added.This PR fixes that by checking whether the option was actually supplied or not.