Skip to content

Commit 2683641

Browse files
authored
Merge pull request #1174 from aigarszuika/master
Changed: Clear Doctrine cache before calculate Root Job Status
2 parents 29584b1 + 29e0260 commit 2683641

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pkg/job-queue/CalculateRootJobStatusService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ protected function calculateRootJobStatus(array $jobs)
6969
$success = 0;
7070

7171
foreach ($jobs as $job) {
72+
$this->jobStorage->refreshJobEntity($job);
7273
switch ($job->getStatus()) {
7374
case Job::STATUS_NEW:
7475
$new++;

pkg/job-queue/Doctrine/JobStorage.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,18 @@ public function findJobById($id)
5858
{
5959
$qb = $this->getEntityRepository()->createQueryBuilder('job');
6060

61-
return $qb
61+
$job = $qb
6262
->addSelect('rootJob')
6363
->leftJoin('job.rootJob', 'rootJob')
6464
->where('job = :id')
6565
->setParameter('id', $id)
6666
->getQuery()->getOneOrNullResult()
6767
;
68+
if ($job) {
69+
$this->refreshJobEntity($job);
70+
}
71+
72+
return $job;
6873
}
6974

7075
/**
@@ -179,6 +184,14 @@ public function saveJob(Job $job, \Closure $lockCallback = null)
179184
}
180185
}
181186

187+
/**
188+
* @param Job $job
189+
*/
190+
public function refreshJobEntity($job)
191+
{
192+
$this->getEntityManager()->refresh($job);
193+
}
194+
182195
/**
183196
* @return EntityRepository
184197
*/

0 commit comments

Comments
 (0)