From: Aaron Schulz Date: Wed, 31 Oct 2012 00:32:50 +0000 (-0700) Subject: [JobQueue] Make use of the isEmpty() function caching in pop(). X-Git-Tag: 1.31.0-rc.0~21800 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=07dd9b0b71ba5df3de559edd93f5d5b0b2968519;p=lhc%2Fweb%2Fwiklou.git [JobQueue] Make use of the isEmpty() function caching in pop(). Change-Id: I92f538f4eb1e912f3446423a0ca51d9a63bf4457 --- diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php index f6003b239d..d9465fb2c4 100644 --- a/includes/job/JobQueueDB.php +++ b/includes/job/JobQueueDB.php @@ -111,11 +111,14 @@ class JobQueueDB extends JobQueue { protected function doPop() { global $wgMemc; - $uuid = wfRandomString( 32 ); // pop attempt + if ( $wgMemc->get( $this->getEmptinessCacheKey() ) === 'true' ) { + return false; // queue is empty + } $dbw = $this->getMasterDB(); $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction + $uuid = wfRandomString( 32 ); // pop attempt $job = false; // job popped off $autoTrx = $dbw->getFlag( DBO_TRX ); // automatic begin() enabled? $dbw->clearFlag( DBO_TRX ); // make each query its own transaction