From 7cdce8f678f9443e1fc13450a333bb87b6da9c3a Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Wed, 5 Oct 2022 09:47:16 +1300 Subject: [PATCH 1/2] FIX grabMutex job lock query on SQLite --- src/Services/QueuedJobService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/QueuedJobService.php b/src/Services/QueuedJobService.php index b2635d62..023567f6 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)))->first(); From b58dfbacd406f6f84cb346089d114b0c1b3c48a8 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 14 Dec 2023 15:25:00 +1300 Subject: [PATCH 2/2] MNT Update @methods on class docblocks --- src/DataObjects/QueuedJobDescriptor.php | 3 +-- src/Extensions/ScheduledExecutionExtension.php | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) 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 {