jenkins-bot has submitted this change and it was merged.

Change subject: Prevent duplicate updates
......................................................................


Prevent duplicate updates

- $updated is a list of page titles, not ids
- Keep updatePages() from handling duplicate pages

Bug: 66858
Change-Id: I905e7398c9c033d6eef7cb05f8377470cca22a33
---
M includes/Updater.php
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Manybubbles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Updater.php b/includes/Updater.php
index b64b1ab..8fd6211 100644
--- a/includes/Updater.php
+++ b/includes/Updater.php
@@ -168,6 +168,16 @@
        public function updatePages( $pages, $shardTimeout, $clientSideTimeout, 
$flags ) {
                $profiler = new ProfileSection( __METHOD__ );
 
+               // Don't update the same page twice. We shouldn't, but meh
+               $pageIds = array();
+               $pages = array_filter( $pages, function( $page ) use ( 
&$pageIds ) {
+                       if ( !in_array( $page->getId(), $pageIds ) ) {
+                               $pageIds[] = $page->getId();
+                               return true;
+                       }
+                       return false;
+               } );
+
                if ( $clientSideTimeout !== null ) {
                        Connection::setTimeout( $clientSideTimeout );
                }
@@ -427,7 +437,7 @@
                                // This is a redirect to a redirect which 
doesn't count in the search score any way.
                                continue;
                        }
-                       if ( in_array( $page->getId(), $this->updated ) ) {
+                       if ( in_array( $title->getFullText(), $this->updated ) 
) {
                                // We've already updated this page in this 
proces so there is no need to update it again.
                                continue;
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/140825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I905e7398c9c033d6eef7cb05f8377470cca22a33
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to