Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
GromNaN merged 1 commit intosymfony:4.4fromfritzmg:patch-2
Jan 8, 2022

Conversation

@fritzmg
Copy link
Contributor

@fritzmgfritzmg commentedJan 6, 2022
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

By defaultmessenger: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.

bin/console messenger:consume --time-limit=1

However, this would allow the worker to consume multiple message for the duration of 1000ms - so technically if you want the worker toimmediately exit each time after it processed the current message queue it should actually be

bin/console messenger:consume --time-limit=0

But this does not currently work, as the zero is falsey and thus theStopWorkerOnTimeLimitListener will not actually be added.

This PR fixes that by checking whether the option was actually supplied or not.

@micheh
Copy link
Contributor

Why don't you add--limit=1 to stop the worker after one message?

OskarStark reacted with thumbs up emoji

@stof
Copy link
Member

stof commentedJan 6, 2022
edited
Loading

@micheh that's a legitimate question. But to me, the PR still makes sense.

@fritzmg
Copy link
ContributorAuthor

fritzmg commentedJan 6, 2022
edited
Loading

Why don't you add--limit=1 to stop the worker after one message?

Using only--limit=1 would still let the worker run indefinitely - until a message actually arrives. I want to let the worker stop immediately.

@OskarStark
Copy link
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?

GromNaN reacted with thumbs up emoji

@fritzmg
Copy link
ContributorAuthor

The usage of time-limit=0 could be confusing?

Not to an engineer? ;)

@GromNaNGromNaN closed thisJan 8, 2022
@GromNaNGromNaN reopened thisJan 8, 2022
@GromNaN
Copy link
Member

Thank you@fritzmg.

@GromNaNGromNaN merged commitddfaf70 intosymfony:4.4Jan 8, 2022
This was referencedJan 28, 2022
@fritzmgfritzmg deleted the patch-2 branchMarch 15, 2025 16:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@GromNaNGromNaNGromNaN approved these changes

@stofstofstof approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

7 participants

@fritzmg@micheh@stof@OskarStark@GromNaN@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp