Skip to content

Commit

Permalink
Merge pull request #55 from johannesx75/patch-2
Browse files Browse the repository at this point in the history
Added Option to disable MySQL row-level locking
  • Loading branch information
edlinklater authored Jul 23, 2016
2 parents bb3e3e3 + dd0cd5d commit 12ae4c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/model/StaticPagesQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class StaticPagesQueue extends DataObject {
'freshness_priority_created' => '(Freshness, Priority, Created)',
);

/**
*
* @var boolean
*/
private static $disable_mysql_locks = false;

/**
*
* @var boolean
Expand Down Expand Up @@ -166,7 +172,7 @@ protected static function get_queue_object($freshness, $interval = null, $sortOr
$filteredQuery = $query->filter($filterQuery)->sort($sortOrder);

if ($filteredQuery->Count() > 0) {
if (DB::getConn() instanceof MySQLDatabase) { //locking currently only works on MySQL
if (!self::config()->disable_mysql_locks && DB::getConn() instanceof MySQLDatabase) { //locking currently only works on MySQL

do {
$queueObject = $filteredQuery->limit(1, $offset)->first(); //get first item
Expand Down

0 comments on commit 12ae4c0

Please sign in to comment.