From: Aaron Schulz Date: Thu, 1 Sep 2016 17:01:25 +0000 (-0700) Subject: Remove $recursionGuard var from tryOpportunisticExecute() X-Git-Tag: 1.31.0-rc.0~5796 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=c1ebcb0ee24dc6da4ca59a9650b97e89d3b61d7e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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(); } /**