aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/WatchedItemStore.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php
index f0619d69f50e..6486955fc488 100644
--- a/includes/WatchedItemStore.php
+++ b/includes/WatchedItemStore.php
@@ -744,15 +744,24 @@ class WatchedItemStore implements StatsdAwareInterface {
$fname = __METHOD__;
$dbw->onTransactionIdle(
function () use ( $dbw, $timestamp, $watchers, $target, $fname ) {
- $dbw->update( 'watchlist',
- [ /* SET */
- 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
- ], [ /* WHERE */
- 'wl_user' => $watchers,
- 'wl_namespace' => $target->getNamespace(),
- 'wl_title' => $target->getDBkey(),
- ], $fname
- );
+ global $wgUpdateRowsPerQuery;
+
+ $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
+ foreach ( $watchersChunks as $watchersChunk ) {
+ $dbw->update( 'watchlist',
+ [ /* SET */
+ 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
+ ], [ /* WHERE - TODO Use wl_id T130067 */
+ 'wl_user' => $watchersChunk,
+ 'wl_namespace' => $target->getNamespace(),
+ 'wl_title' => $target->getDBkey(),
+ ], $fname
+ );
+ if ( count( $watchersChunks ) > 1 ) {
+ $dbw->commit( __METHOD__, 'flush' );
+ wfGetLBFactory()->waitForReplication( [ 'wiki' => $dbw->getWikiID() ] );
+ }
+ }
$this->uncacheLinkTarget( $target );
}
);