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

Change subject: Leak less memory in forceSearchIndex.php
......................................................................


Leak less memory in forceSearchIndex.php

On my test wiki with 6461 pages (yeah, not many) this uses ~25% less memory.
I'm sure this isn't all the leaks, but it was a pretty simple one to fix.

Also, fix some missing use statements on maintenance scripts.

Bug:  59164
Change-Id: I1eae0f32dc0e4288818548218facac8a18d60732
---
M includes/ReindexForkController.php
M maintenance/forceSearchIndex.php
M maintenance/updateOneSearchIndexConfig.php
3 files changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/includes/ReindexForkController.php 
b/includes/ReindexForkController.php
index 2279f5b..9f2ecaa 100644
--- a/includes/ReindexForkController.php
+++ b/includes/ReindexForkController.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace CirrusSearch;
+use \ForkController;
 
 /**
  * Extensions to ForeController to prepare Elastica and to tell the child
diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 80332b4..b3de409 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -1,8 +1,10 @@
 <?php
 
 namespace CirrusSearch;
-use \Maintenance;
 use \CirrusSearch;
+use \JobQueueGroup;
+use \LinkCache;
+use \Maintenance;
 use \WikiPage;
 
 /**
@@ -333,6 +335,8 @@
                        }
                        $result[] = $update;
                }
+               // Clear the LinkCache to prevent its memory use from growing 
without bounds.
+               LinkCache::singleton()->clear();
                wfProfileOut( __METHOD__ . '::decodeResults' );
                wfProfileOut( __METHOD__ );
                return $result;
diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index 3092360..a94cc35 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace CirrusSearch;
+use Elastica;
 use \Maintenance;
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1eae0f32dc0e4288818548218facac8a18d60732
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <never...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to