From c1ebcb0ee24dc6da4ca59a9650b97e89d3b61d7e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 1 Sep 2016 10:01:25 -0700 Subject: [PATCH] Remove $recursionGuard var from tryOpportunisticExecute() Aside from there being no idle callback setting here, the old addUpdate() code that runs updates allows nesting updates. Make this support that for a few transitional commits. It will be changed later to simply order the sub-updates after their parent updates, keeping both outer scope for all updates and locality of related updates. Change-Id: I0ad4e9713a7893b981b7bb013e9db803eed663b2 --- includes/deferred/DeferredUpdates.php | 30 +++++++++------------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index 5622f9560d..48f1e8ef26 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -195,29 +195,19 @@ class DeferredUpdates { * @since 1.28 */ public static function tryOpportunisticExecute( $mode = 'run' ) { - static $recursionGuard = false; - if ( $recursionGuard ) { - return false; // COMMITs trigger inside update loop and inside some updates + if ( !self::getBusyDbConnections() ) { + self::doUpdates( $mode ); + return true; } - try { - $recursionGuard = true; - if ( !self::getBusyDbConnections() ) { - self::doUpdates( $mode ); - return true; - } - - if ( self::pendingUpdatesCount() >= self::BIG_QUEUE_SIZE ) { - // If we cannot run the updates with outer transaction context, try to - // at least enqueue all the updates that support queueing to job queue - self::$preSendUpdates = self::enqueueUpdates( self::$preSendUpdates ); - self::$postSendUpdates = self::enqueueUpdates( self::$postSendUpdates ); - } - - return !self::pendingUpdatesCount(); - } finally { - $recursionGuard = false; + if ( self::pendingUpdatesCount() >= self::BIG_QUEUE_SIZE ) { + // If we cannot run the updates with outer transaction context, try to + // at least enqueue all the updates that support queueing to job queue + self::$preSendUpdates = self::enqueueUpdates( self::$preSendUpdates ); + self::$postSendUpdates = self::enqueueUpdates( self::$postSendUpdates ); } + + return !self::pendingUpdatesCount(); } /** -- 2.20.1