From 07dd9b0b71ba5df3de559edd93f5d5b0b2968519 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 30 Oct 2012 17:32:50 -0700 Subject: [PATCH] [JobQueue] Make use of the isEmpty() function caching in pop(). Change-Id: I92f538f4eb1e912f3446423a0ca51d9a63bf4457 --- includes/job/JobQueueDB.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.20.1