jenkins-bot has submitted this change and it was merged.
Change subject: Bail early if another script is queueing jobs
......................................................................
Bail early if another script is queueing jobs
If another script is queueing index build jobs for the same wiki then it'll
wait for them to empty so the current execution doesn't have to.
Change-Id: I3b5994cdb00406ee6b6889f4680e86822364daf4
---
M maintenance/forceSearchIndex.php
1 file changed, 8 insertions(+), 0 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php
index 6516e21..8845d02 100644
--- a/maintenance/forceSearchIndex.php
+++ b/maintenance/forceSearchIndex.php
@@ -223,6 +223,7 @@
}
$this->output( "$operationName a total of $completed pages at
$rate/second\n" );
+ $lastQueueSizeForOurJob = PHP_INT_MAX;
if ( $this->queue ) {
$this->output( "Waiting for jobs to drain from the
queue\n" );
while ( true ) {
@@ -230,8 +231,15 @@
if ( $queueSizeForOurJob === 0 ) {
break;
}
+ // We subtract 5 because we some jobs may be
added by deletes
+ if ( $queueSizeForOurJob >
$lastQueueSizeForOurJob ) {
+ $this->output( "Queue size went up.
Another script is likely adding jobs " .
+ "and it'll wait for them to
empty.\n" );
+ break;
+ }
$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/129628
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3b5994cdb00406ee6b6889f4680e86822364daf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits