Add queue worker setting so those aren't run in cron if there's a worker

This commit is contained in:
Nabeel Shahzad
2021-05-21 12:31:32 -04:00
parent d3ec0f4de3
commit c94358350a
3 changed files with 31 additions and 10 deletions

View File

@@ -26,9 +26,12 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command(JobQueue::class)
->everyMinute()
->withoutOverlapping();
// If not using the queue worker then run those via cron
if (!config('queue.worker', false)) {
$schedule->command(JobQueue::class)
->everyMinute()
->withoutOverlapping();
}
$schedule->command(Nightly::class)->dailyAt('01:00');
$schedule->command(Weekly::class)->weeklyOn(0);

View File

@@ -16,6 +16,11 @@ return [
'default' => env('QUEUE_DRIVER', 'sync'),
/**
* If you're using the queue worker, then disable running queued tasks via cron
*/
'worker' => env('QUEUE_WORKER', false),
/*
|--------------------------------------------------------------------------
| Queue Connections

View File

@@ -22,7 +22,8 @@ LOG_LEVEL=debug
APP_DEBUG=$APP_DEBUG$
DEBUG_TOOLBAR=$DEBUG_TOOLBAR$
# DATABASE SETTINGS
## DATABASE SETTINGS
DB_CONNECTION=$DB_CONNECTION$
DB_HOST='$DB_HOST$'
DB_PORT=$DB_PORT$
@@ -33,18 +34,19 @@ DB_PREFIX='$DB_PREFIX$'
DB_EMULATE_PREPARES=$DB_EMULATE_PREPARES$
DB_SOCKET=
# CACHE SETTINGS
## CACHE SETTINGS
# https://docs.phpvms.net/config/optimizing#caching
CACHE_DRIVER=$CACHE_DRIVER$
CACHE_PREFIX='$CACHE_PREFIX$'
# QUEUE SETTINGS
# Set this to "database" if you have slow pages due to notifications/emails
# They will then be sent out via cron
QUEUE_DRIVER=sync
## EMAIL SETTINGS
# EMAIL SETTINGS
# Look at the available mail configs in config/mail.php
# Also refer to the Laravel docs here: https://laravel.com/docs/8.x/mail
# If you're using SMTP, I recommend setting the QUEUE_DRIVER to 'database'
# https://docs.phpvms.net/config/optimizing#queue-driver
MAIL_DRIVER=$MAIL_DRIVER$
MAIL_FROM_NAME='$MAIL_FROM_NAME$'
MAIL_FROM_ADDRESS='$MAIL_FROM_ADDRESS$'
@@ -53,3 +55,14 @@ MAIL_PORT=$MAIL_PORT$
MAIL_ENCRYPTION=$MAIL_ENCRYPTION$
MAIL_USERNAME=$MAIL_USERNAME$
MAIL_PASSWORD=$MAIL_PASSWORD$
## QUEUE SETTINGS
# Set this to "database" if you have slow pages due to notifications/emails
# They will then be sent out via cron
QUEUE_DRIVER=sync
# If you're using the Laravel Queue Worker, set this to true. This will stop the queue tasks
# from being run during the cron job
# https://laravel.com/docs/8.x/queues#running-the-queue-worker
QUEUE_WORKER=false