Jobs not being updated
This commit is contained in:
@ -5,7 +5,7 @@ use PDOException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Exception\ServiceAction\{Create,Read};
|
||||
use Incoviba\Exception\ServiceAction\{Create, Read, Update};
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Model;
|
||||
|
||||
@ -44,6 +44,21 @@ class Job extends Ideal\Service
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Job $job
|
||||
* @return bool
|
||||
* @throws Update
|
||||
*/
|
||||
public function execute(Model\Job $job): bool
|
||||
{
|
||||
try {
|
||||
$this->jobRepository->edit($job, ['executed' => true]);
|
||||
return true;
|
||||
} catch (EmptyResult | PDOException $exception) {
|
||||
throw new Update(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
protected function process(Model\Job $job): Model\Job
|
||||
{
|
||||
return $job;
|
||||
|
@ -59,6 +59,10 @@ class Queue extends Ideal\Service
|
||||
try {
|
||||
if (!$worker->execute($job)) {
|
||||
$errors []= $job->id;
|
||||
} else {
|
||||
if (!$this->jobService->execute($job)) {
|
||||
$errors []= $job->id;
|
||||
}
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
$final = new Exception("Could not run job", 0, $exception);
|
||||
|
Reference in New Issue
Block a user