Skip to content

Commit

Permalink
Merge branch '5.0' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Dec 19, 2023
2 parents 33e5ec5 + 5bd3eeb commit b552916
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/DataObjects/QueuedJobDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@
* @property bool $NotifiedBroken
* @property int $WorkerCount
*
* @method Member RunAs() Member to run this job as
*
* @author Marcus Nyeholt <[email protected]>
* @license BSD http://silverstripe.org/bsd-license/
* @method Member RunAs()
*/
class QueuedJobDescriptor extends DataObject
{
Expand Down
1 change: 1 addition & 0 deletions src/Extensions/ScheduledExecutionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*
* @author [email protected]
* @license BSD License http://silverstripe.org/bsd-license/
* @method QueuedJobDescriptor ScheduledJob()
*/
class ScheduledExecutionExtension extends DataExtension
{
Expand Down
3 changes: 2 additions & 1 deletion src/Services/QueuedJobService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit b552916

Please sign in to comment.