Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class WorkCommand extends Command
{--queue= : The names of the queues to work}
{--daemon : Run the worker in daemon mode (Deprecated)}
{--once : Only process the next job on the queue}
{--ignore-reset-signal : Ignore reset signal in order to reduce cache call}
{--stop-when-empty : Stop when the queue is empty}
{--delay=0 : The number of seconds to delay failed jobs (Deprecated)}
{--backoff=0 : The number of seconds to wait before retrying a job that encountered an uncaught exception}
Expand Down Expand Up @@ -169,6 +170,7 @@ protected function gatherWorkerOptions()
$this->option('max-jobs'),
$this->option('max-time'),
$this->option('rest'),
$this->option('ignore-reset-signal'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startT
return match (true) {
$this->shouldQuit => static::EXIT_SUCCESS,
$this->memoryExceeded($options->memory) => static::$memoryExceededExitCode ?? static::EXIT_MEMORY_LIMIT,
$this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS,
! $options->ignoreResetSignal && $this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS,
$options->stopWhenEmpty && is_null($job) => static::EXIT_SUCCESS,
$options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => static::EXIT_SUCCESS,
$options->maxJobs && $jobsProcessed >= $options->maxJobs => static::EXIT_SUCCESS,
Expand Down
9 changes: 9 additions & 0 deletions src/Illuminate/Queue/WorkerOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class WorkerOptions
*/
public $maxTime;

/**
* Indicates if the worker should ignore reset signal. This is used when you want decrease cache queries on illuminate:queue:restart.
*
* @var bool
*/
public $ignoreResetSignal;

/**
* Create a new worker options instance.
*
Expand Down Expand Up @@ -108,6 +115,7 @@ public function __construct(
$maxJobs = 0,
$maxTime = 0,
$rest = 0,
$ignoreResetSignal = false,
) {
$this->name = $name;
$this->backoff = $backoff;
Expand All @@ -120,5 +128,6 @@ public function __construct(
$this->stopWhenEmpty = $stopWhenEmpty;
$this->maxJobs = $maxJobs;
$this->maxTime = $maxTime;
$this->ignoreResetSignal = $ignoreResetSignal;
}
}