diff --git a/src/DataObjects/QueuedJobDescriptor.php b/src/DataObjects/QueuedJobDescriptor.php index cedaaffc..09e67b64 100644 --- a/src/DataObjects/QueuedJobDescriptor.php +++ b/src/DataObjects/QueuedJobDescriptor.php @@ -52,10 +52,9 @@ * @property bool $NotifiedBroken * @property int $WorkerCount * - * @method Member RunAs() Member to run this job as - * * @author Marcus Nyeholt * @license BSD http://silverstripe.org/bsd-license/ + * @method Member RunAs() */ class QueuedJobDescriptor extends DataObject { diff --git a/src/Extensions/ScheduledExecutionExtension.php b/src/Extensions/ScheduledExecutionExtension.php index fd23caba..ead6cc4f 100644 --- a/src/Extensions/ScheduledExecutionExtension.php +++ b/src/Extensions/ScheduledExecutionExtension.php @@ -23,6 +23,7 @@ * * @author marcus@symbiote.com.au * @license BSD License http://silverstripe.org/bsd-license/ + * @method QueuedJobDescriptor ScheduledJob() */ class ScheduledExecutionExtension extends DataExtension { diff --git a/src/Services/QueuedJobService.php b/src/Services/QueuedJobService.php index ea98b8ea..70c89f36 100644 --- a/src/Services/QueuedJobService.php +++ b/src/Services/QueuedJobService.php @@ -729,7 +729,8 @@ protected function grabMutex(QueuedJobDescriptor $jobDescriptor) try { // Start a transaction which will hold until we have a lock on this descriptor. DB::get_conn()->withTransaction(function () use ($descriptorId) { - $query = 'SELECT "ID" FROM "QueuedJobDescriptor" WHERE "ID" = %s AND "Worker" IS NULL FOR UPDATE'; + $forUpdate = DB::getConfig()['type'] == 'SQLite3Database' ? '' : ' FOR UPDATE'; + $query = 'SELECT "ID" FROM "QueuedJobDescriptor" WHERE "ID" = %s AND "Worker" IS NULL' . $forUpdate; $row = DB::query(sprintf($query, Convert::raw2sql($descriptorId)))->record();