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] Fix graceful exit#52080
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
| $this->worker->stop(); | ||
| return0; | ||
| returnfalse; |
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.
There's no need to exit here, we just have to call$this->worker->stop() and the command will finish gracefully once the handler is done.
| $shouldHandle =$shouldForce ||'retry' ===$io->choice('Please select an action', ['retry','delete'],'retry'); | ||
| $this->forceExit =true; | ||
| try { | ||
| $shouldHandle =$shouldForce ||'retry' ===$io->choice('Please select an action', ['retry','delete'],'retry'); | ||
| }finally { | ||
| $this->forceExit =false; | ||
| } |
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.
With themessenger:failed:retry it's a little different, the$io->choice() method has an infinitive loop, so we need to exit if the command is waiting for an answer, otherwise we're stuck in the loop, which is the original issue that I tried to fix in#50787.
| if ($this->shouldStop) { | ||
| break; | ||
| } |
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.
This is required because the worker is instantiated in loops as well.
| // avoid success message if nothing was processed | ||
| if (1 <=$count) { | ||
| if (1 <=$count && !$this->shouldStop) { |
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.
To avoid printing the message if the command has been terminated.
fabpot commentedOct 16, 2023
Thank you@HypeMC. |
This PR was merged into the 6.3 branch.Discussion----------[Messenger] Fix graceful exit with ids| Q | A| ------------- | ---| Branch? | 6.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MITOne last case I missed in#52080Commits-------1fc56bb [Messenger] Fix graceful exit with ids
My previous PR#50787 accidentally broke the behavior of the
messenger:consumecommand. It no longer waits for the handler to finish, instead it exists immediately.