feature/cierres #25

Open
aldarien wants to merge 446 commits from feature/cierres into develop
214 changed files with 663 additions and 7157 deletions
Showing only changes of commit 0f0c81e283 - Show all commits

View File

@ -2,6 +2,7 @@
namespace Incoviba\Service;
use Exception;
use Psr\Http\Message\RequestInterface;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Ideal;
use Incoviba\Exception\ServiceAction\{Create, Read};
@ -34,7 +35,7 @@ class Queue extends Ideal\Service
}
}
public function run(): bool
public function run(?RequestInterface $request): bool
{
try {
$jobs = $this->jobService->getPending();
@ -55,20 +56,24 @@ class Queue extends Ideal\Service
}
$worker = $this->workers[$type];
if (is_a($worker, Service\Worker\Request::class)) {
$worker->setRequest($request);
}
try {
if (!$worker->execute($job)) {
$errors []= $job->id;
} else {
if (!$this->jobService->execute($job)) {
$errors []= $job->id;
}
continue;
}
if (!$this->jobService->execute($job)) {
$errors []= $job->id;
}
} catch (Exception $exception) {
$final = new Exception("Could not run job", 0, $exception);
$this->logger->warning($final);
$errors []= $job->id;
}
break;
}
return count($errors) === 0;
}