From ee20da4346ccf22e3b48f3a730dbb2bd30ff36e3 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 18 Oct 2014 18:41:21 -0700 Subject: [PATCH] Always supported delayed jobs in JobQueueRedis for simplicity * Previously, each job type had to be configured to allow delayed jobs Change-Id: I5f3cf04deca76d6684aa6b14eea97a8673a7f5af --- includes/jobqueue/JobQueueRedis.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index e6724f7432..abfdc8c74e 100644 --- a/includes/jobqueue/JobQueueRedis.php +++ b/includes/jobqueue/JobQueueRedis.php @@ -91,6 +91,7 @@ class JobQueueRedis extends JobQueue { $this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none'; $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] ); $this->daemonized = !empty( $params['daemonized'] ); + $this->checkDelay = true; // always enabled } protected function supportedOrders() { @@ -152,9 +153,6 @@ class JobQueueRedis extends JobQueue { * @throws JobQueueError */ protected function doGetDelayedCount() { - if ( !$this->checkDelay ) { - return 0; // no delayed jobs - } $conn = $this->getConnection(); try { return $conn->zSize( $this->getQueueKey( 'z-delayed' ) ); @@ -295,7 +293,7 @@ LUA; // Push ready delayed jobs into the queue every 10 jobs to spread the load. // This is also done as a periodic task, but we don't want too much done at once. - if ( !$this->daemonized && $this->checkDelay && mt_rand( 0, 9 ) == 0 ) { + if ( !$this->daemonized && mt_rand( 0, 9 ) == 0 ) { $this->recyclePruneAndUndelayJobs(); } @@ -678,13 +676,10 @@ LUA; if ( $this->daemonized ) { return array(); // managed in the runner loop } - $periods = array( 3600 ); // standard cleanup (useful on config change) + $periods = array( 300 ); // 5 min; delayed/stale jobs if ( $this->claimTTL > 0 ) { $periods[] = ceil( $this->claimTTL / 2 ); // halved to avoid bad timing } - if ( $this->checkDelay ) { - $periods[] = 300; // 5 minutes - } $period = min( $periods ); $period = max( $period, 30 ); // sanity -- 2.20.1