Skip to content

Commit

Permalink
Merge branch '4.0' into 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed May 27, 2019
2 parents c7d3fcb + b7b5624 commit d0fb2e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Services/QueuedJobService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector;
Expand Down Expand Up @@ -551,15 +550,18 @@ protected function grabMutex(QueuedJobDescriptor $jobDescriptor)
// and thus the row would always be affected.
try {
DB::query(sprintf(
'UPDATE "QueuedJobDescriptor" SET "JobStatus" = \'%s\' WHERE "ID" = %s',
'UPDATE "QueuedJobDescriptor" SET "JobStatus" = \'%s\' WHERE "ID" = %s'
. ' AND "JobFinished" IS NULL AND "JobStatus" NOT IN (%s)',
QueuedJob::STATUS_INIT,
$jobDescriptor->ID
$jobDescriptor->ID,
"'" . QueuedJob::STATUS_RUN . "', '" . QueuedJob::STATUS_COMPLETE . "', '"
. QueuedJob::STATUS_PAUSED . "', '" . QueuedJob::STATUS_CANCELLED . "'"
));
} catch (Exception $e) {
return false;
}

if (DB::getConn()->affectedRows() === 0 && $jobDescriptor->JobStatus !== QueuedJob::STATUS_INIT) {
if (DB::get_conn()->affectedRows() === 0 && $jobDescriptor->JobStatus !== QueuedJob::STATUS_INIT) {
return false;
}

Expand Down

0 comments on commit d0fb2e2

Please sign in to comment.