-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add task queue:restart for Laravel recipe #1007
Conversation
recipe/laravel.php
Outdated
desc('Execute artisan queue:restart'); | ||
task('artisan:queue:restart', function () { | ||
run('{{bin/php}} {{release_path}}/artisan queue:restart'); | ||
writeln('<info>' . $output . '</info>'); |
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.
$output
is undefined. There is no need of writing output here.
Also, please add this to deploy flow and CHANGELOG.md. |
I am not sure actually if there is a point for displaying the output at all, since it is pretty much fixed. So I removed it. I added task to the the deployment flow as you asked. Please note that not all Laravel applications use queues, but I guess it is a sensible default. But the command works even if you have set the queue driver to "sync" so there is no harm done. |
@lasselehtinen so it's safe for all laravel users? If them not using queue? |
@Elfet Yes it is safe to run always but might not be always necessary. Personally I have queue jobs on pretty much on all Laravel projects, but that is just me. But with a gut feeling as there is no statistics that larger majority uses the queue for sending emails, notifications etc. It is a non-blocking operation so it takes only one seconds or less. |
Well, maybe its better to not include this to recipe, but to template of laravel? So users can customize it easily. |
Yes I guess that is a best option, you can easily add I guess that is something that could be covered in the recipe documentation, but I noticed there is no documentation for the Laravel recipe. I will try to contribute on that when I have time. |
@Elfet, it waits your approve and merge. |
I think this should be added by default. It doesn't hurt anyone, it's only creating a cache instance: https://github.com/laravel/framework/blob/5.4/src/Illuminate/Queue/Console/RestartCommand.php So no effect for people not using queue, but very much required for everyone who is using queues! |
Laravel has an artisan command to send a restart signal to the queue workers. This is kind of a must during deployment. I noticed that the Laravel recipe does not have this artisan command, so here is a PR to add this command.
https://laravel.com/docs/5.4/queues#queue-workers-and-deployment