PHRAS-4057: log_doc - report mark as "cancel" for running_job entry (#4501)

* log_docs mark as canceled too

* PHRAS-4058 auto cancelling job

* add auto-cancelingJob in hour in the config

* add patch rc12
This commit is contained in:
Aina Sitraka
2024-04-30 12:44:14 +03:00
committed by GitHub
parent 7e3fe51a2c
commit b0eba5217c
8 changed files with 157 additions and 5 deletions

View File

@@ -503,7 +503,7 @@ class WorkerRunningJobRepository extends EntityRepository
]);
}
public function getRunningSinceCreated($hour = 0)
public function getRunningSinceCreated($hour = 0, array $action = null)
{
$rsm = new ResultSetMappingBuilder($this->_em);
$rsm->addRootEntityFromClassMetadata('Alchemy\Phrasea\Model\Entities\WorkerRunningJob', 'w');
@@ -516,6 +516,11 @@ class WorkerRunningJobRepository extends EntityRepository
AND (TO_SECONDS(CURRENT_TIMESTAMP()) - TO_SECONDS(w.created)) > :second'
;
if ($action != null) {
$action = join('" ,"', $action);
$sql .= ' AND work IN("' . $action . '")';
}
$q = $this->_em->createNativeQuery($sql, $rsm);
$q->setParameters([
'second' => $hour * 3600,