Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Messenger] Add a new time limit receiver#27130
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| private$timeLimit; | ||
| private$logger; | ||
| publicfunction__construct(ReceiverInterface$decoratedReceiver,int$timeLimit,LoggerInterface$logger =null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
please name the variable like $timeLimitInSeconds to make it clear what unit this is in
| if ($endTime <time()) { | ||
| $this->stop(); | ||
| if (null !==$this->logger) { | ||
| $this->logger->info('Receiver stopped due to time limit of {timeLimit} reached',array('timeLimit' =>$this->timeLimit)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
unit seconds missing
| $timeoutReceiver =newStopWhenTimeLimitIsReachedReceiver($decoratedReceiver,1,$logger); | ||
| $timeoutReceiver->receive(function () { | ||
| sleep(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
in order to not really wait for 2s during tests, the test case should be@group time-sensitive
| <info>php %command.full_name% <receiver-name> --memory-limit=128M</info> | ||
| Use the --time-limit option to stop the worker if it the given time limit is reached: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- if it+ when
- given time limit+ given time limit (in seconds)
sroze commentedMay 4, 2018
@sdelicata your commits have multiple authors: could you squash them into one for us please? |
sdelicata commentedMay 4, 2018
@sroze Done ! |
sroze commentedMay 4, 2018
Thank you@sdelicata. |
This PR was merged into the 4.1-dev branch.Discussion----------[Messenger] Add a new time limit receiver| Q | A| ------------- | ---| Branch? | master for features| Bug fix? | no| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass? | yes| License | MITNew feature to add a time limit option to the ConsumeMessagesCommand.```bin/console messenger:consume-messages <receiver-name> -t 3600```Commits-------5536ee1 Add a new time limit receiver
| if ($endTime <time()) { | ||
| $this->stop(); | ||
| if (null !==$this->logger) { | ||
| $this->logger->info('Receiver stopped due to time limit of {timeLimit}s reached',array('timeLimit' =>$this->timeLimitInSeconds)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
use short array syntax
New feature to add a time limit option to the ConsumeMessagesCommand.