From d66d388caad4cbe7ff5926d44398ee394961f644 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 9 Feb 2019 23:27:14 +0000 Subject: [PATCH] Make attachLatest.php wait for DB replica lag Change-Id: I4f402ba772d0b0dda8360eaacf11e318f659efc0 --- maintenance/attachLatest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maintenance/attachLatest.php b/maintenance/attachLatest.php index 897972c75a..4da09018c4 100644 --- a/maintenance/attachLatest.php +++ b/maintenance/attachLatest.php @@ -24,6 +24,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -53,6 +55,7 @@ class AttachLatest extends Maintenance { $conds, __METHOD__ ); + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $n = 0; foreach ( $result as $row ) { $pageId = intval( $row->page_id ); @@ -78,6 +81,7 @@ class AttachLatest extends Maintenance { if ( $this->hasOption( 'fix' ) ) { $page = WikiPage::factory( $title ); $page->updateRevisionOn( $dbw, $revision ); + $lbFactory->waitForReplication(); } $n++; } -- 2.20.1