From: Aaron Schulz Date: Mon, 25 Feb 2013 17:55:32 +0000 (-0800) Subject: Made runJobs.php wait for slave lag. X-Git-Tag: 1.31.0-rc.0~20464^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=d8c2a618e559a61ae8e3ae2507eeef77b0173e4f;p=lhc%2Fweb%2Fwiklou.git Made runJobs.php wait for slave lag. * Relying on waitForBackups() alone will not work with non DB queues. Change-Id: I2124c5cd11a70d183cfde00ad21d6642a3a0ee9e --- diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index f9557ce65e..714bb84845 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -82,6 +82,7 @@ class RunJobs extends Maintenance { $this->runJobsLog( "Executed $count periodic queue task(s)." ); } + $lastTime = time(); do { $job = ( $type === false ) ? $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE ) @@ -118,8 +119,13 @@ class RunJobs extends Maintenance { break; } - // Don't let any slaves/backups fall behind... + // Don't let any queue slaves/backups fall behind $group->get( $job->getType() )->waitForBackups(); + // Don't let any of the main DB slaves get backed up + $timePassed = time() - $lastTime; + if ( $timePassed >= 5 || $timePassed < 0 ) { + wfWaitForSlaves(); + } } } while ( $job ); // stop when there are no jobs }