X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2Floadbalancer%2FLBFactory.php;h=4758cc77a14c571e31a6469069311dc173e70f1d;hb=36d54d95e3606be4222558d1d29e60637036bece;hp=cd8dff32a11dfc003b879cdbbea814f7f987c610;hpb=0f05bb3a01060494e8934f135af78c71a9374ce3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/loadbalancer/LBFactory.php b/includes/db/loadbalancer/LBFactory.php index cd8dff32a1..4758cc77a1 100644 --- a/includes/db/loadbalancer/LBFactory.php +++ b/includes/db/loadbalancer/LBFactory.php @@ -430,10 +430,6 @@ abstract class LBFactory implements DestructibleService { 'ifWritesSince' => null ]; - foreach ( $this->replicationWaitCallbacks as $callback ) { - $callback(); - } - // Figure out which clusters need to be checked /** @var LoadBalancer[] $lbs */ $lbs = []; @@ -467,6 +463,12 @@ abstract class LBFactory implements DestructibleService { $masterPositions[$i] = $lb->getMasterPos(); } + // Run any listener callbacks *after* getting the DB positions. The more + // time spent in the callbacks, the less time is spent in waitForAll(). + foreach ( $this->replicationWaitCallbacks as $callback ) { + $callback(); + } + $failed = []; foreach ( $lbs as $i => $lb ) { if ( $masterPositions[$i] ) {