Skip to content

Commit

Permalink
Merge pull request #9688 from jonasraoni/bugfix/main/9686-fix-jobs-ar…
Browse files Browse the repository at this point in the history
…guments

#9686 Fixed the setup for the worker configuration
  • Loading branch information
jonasraoni authored Feb 3, 2024
2 parents bba8358 + d1a92ea commit 2d98998
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 0 additions & 2 deletions classes/queue/WorkerConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* @file classes/queue/WorkerConfiguration.php
*
Expand Down
26 changes: 13 additions & 13 deletions tools/jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected function failed(): void

if (in_array('--redispatch', $parameterList) || ($jobIds = $this->getParameterValue('redispatch'))) {
$jobsCount = Repo::failedJob()->redispatchToQueue(
$this->getParameterValue('--queue'),
$this->getParameterValue('queue'),
collect(explode(',', $jobIds ?? ''))
->filter()
->map(fn ($item) => (int)$item)
Expand All @@ -245,7 +245,7 @@ protected function failed(): void

if (in_array('--clear', $parameterList) || ($jobIds = $this->getParameterValue('clear'))) {
$jobsCount = Repo::failedJob()->deleteJobs(
$this->getParameterValue('--queue'),
$this->getParameterValue('queue'),
collect(explode(',', $jobIds ?? ''))
->filter()
->map(fn ($item) => (int)$item)
Expand Down Expand Up @@ -510,17 +510,17 @@ protected function gatherWorkerOptions(array $parameters = []): array
$workerConfig = new WorkerConfiguration();

return [
'name' => $this->getParameterValue('--name', $workerConfig->getName()),
'backoff' => $this->getParameterValue('--backoff', $workerConfig->getBackoff()),
'memory' => $this->getParameterValue('--memory', $workerConfig->getMemory()),
'timeout' => $this->getParameterValue('--timeout', $workerConfig->getTimeout()),
'sleep' => $this->getParameterValue('--sleep', $workerConfig->getSleep()),
'maxTries' => $this->getParameterValue('--tries', $workerConfig->getMaxTries()),
'force' => $this->getParameterValue('--force', in_array('--force', $parameters) ? true : $workerConfig->getForce()),
'stopWhenEmpty' => $this->getParameterValue('--stop-when-empty', in_array('--stop-when-empty', $parameters) ? true : $workerConfig->getStopWhenEmpty()),
'maxJobs' => $this->getParameterValue('--max-jobs', $workerConfig->getMaxJobs()),
'maxTime' => $this->getParameterValue('--max-time', $workerConfig->getMaxTime()),
'rest' => $this->getParameterValue('--rest', $workerConfig->getRest()),
'name' => $this->getParameterValue('name', $workerConfig->getName()),
'backoff' => $this->getParameterValue('backoff', $workerConfig->getBackoff()),
'memory' => $this->getParameterValue('memory', $workerConfig->getMemory()),
'timeout' => $this->getParameterValue('timeout', $workerConfig->getTimeout()),
'sleep' => $this->getParameterValue('sleep', $workerConfig->getSleep()),
'maxTries' => $this->getParameterValue('tries', $workerConfig->getMaxTries()),
'force' => $this->getParameterValue('force', in_array('force', $parameters) ? true : $workerConfig->getForce()),
'stopWhenEmpty' => $this->getParameterValue('stop-when-empty', in_array('stop-when-empty', $parameters) ? true : $workerConfig->getStopWhenEmpty()),
'maxJobs' => $this->getParameterValue('max-jobs', $workerConfig->getMaxJobs()),
'maxTime' => $this->getParameterValue('max-time', $workerConfig->getMaxTime()),
'rest' => $this->getParameterValue('rest', $workerConfig->getRest()),
];
}

Expand Down

0 comments on commit 2d98998

Please sign in to comment.