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