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

Change subject: Adjust rounding of rate in forceSearchIndex.php output
......................................................................


Adjust rounding of rate in forceSearchIndex.php output

Round to one decimal place if rate is less than 1.

Especially when using --forceParse, indexing is not as quick. At least
locally, it's ~0.2/sec for Wikibase items. :/

Change-Id: Id3e1cc55975d24621b7869282ccbb49bf608d222
---
M maintenance/forceSearchIndex.php
1 file changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  DCausse: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 143b54b..ac6af80 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -235,8 +235,10 @@
                                $updater = $this->createUpdater();
                                $updater->deletePages( $titlesToDelete, 
$idsToDelete );
                        }
+
                        $completed += $size;
-                       $rate = round( $completed / ( microtime( true ) - 
$operationStartTime ) );
+                       $rate = $this->calculateIndexingRate( $completed, 
$operationStartTime );
+
                        if ( is_null( $this->toDate ) ) {
                                $endingAt = $minId;
                        } else {
@@ -273,6 +275,22 @@
        }
 
        /**
+        * @param int $completed
+        * @param double $operationStartTime
+        *
+        * @return double
+        */
+       private function calculateIndexingRate( $completed, $operationStartTime 
) {
+               $rate = $completed / ( microtime( true ) - $operationStartTime 
);
+
+               if ( $rate < 1 ) {
+                       return round( $rate, 1 );
+               }
+
+               return round( $rate );
+       }
+
+       /**
         * Do some simple sanity checking to make sure we've got indexes to 
populate.
         * Note this isn't nearly as robust as updateSearchIndexConfig is, but 
it's
         * not designed to be.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3e1cc55975d24621b7869282ccbb49bf608d222
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to