From: Aaron Schulz Date: Fri, 19 Sep 2014 20:28:05 +0000 (-0700) Subject: Randomize the JobRunner slave lags checks a bit X-Git-Tag: 1.31.0-rc.0~13852^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=845ae423486fe1c8186ae4dd2b10e00ac757ad8b;p=lhc%2Fweb%2Fwiklou.git Randomize the JobRunner slave lags checks a bit Change-Id: Iee777426776c12051761d29c90da80cea27619b1 --- diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 8cccedaf3c..cfcd4666b2 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -87,8 +87,10 @@ class JobRunner { $jobsRun = 0; $timeMsTotal = 0; $flags = JobQueueGroup::USE_CACHE; + $checkPeriod = 5.0; // seconds + $checkPhase = mt_rand( 0, 1000 * $checkPeriod ) / 1000; // avoid stampedes $startTime = microtime( true ); // time since jobs started running - $lastTime = microtime( true ); // time since last slave check + $lastTime = microtime( true ) - $checkPhase; // time since last slave check do { // Sync the persistent backoffs with concurrent runners $backoffs = $this->syncBackoffDeltas( $backoffs, $backoffDeltas, $wait );