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

Change subject: Wait two minutes before checking if queue shrinks
......................................................................


Wait two minutes before checking if queue shrinks

Waiting less time might cause the job to stop dueue to redis count lag.

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

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



diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 8845d02..af77a95 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -224,6 +224,7 @@
                $this->output( "$operationName a total of $completed pages at 
$rate/second\n" );
 
                $lastQueueSizeForOurJob = PHP_INT_MAX;
+               $waitStartTime = microtime( true );
                if ( $this->queue ) {
                        $this->output( "Waiting for jobs to drain from the 
queue\n" );
                        while ( true ) {
@@ -237,9 +238,13 @@
                                                "and it'll wait for them to 
empty.\n" );
                                        break;
                                }
+                               if ( microtime( true ) - $waitStartTime > 120 ) 
{
+                                       // Wait at least two full minutes 
before we check if the job count went down.
+                                       // Less then that and we might be 
seeing lag from redis's counts.
+                                       $lastQueueSizeForOurJob = 
$queueSizeForOurJob;
+                               }
                                $this->output( "$queueSizeForOurJob jobs left 
on the queue.\n" );
                                usleep( 
self::SECONDS_BETWEEN_JOB_QUEUE_LENGTH_CHECKS * 1000000 );
-                               $lastQueueSizeForOurJob = $queueSizeForOurJob;
                        }
                }
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf506f9e2eb5993571d7c7385bc234442ecd277a
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