From 6f9a246d25b29d406e68e366e707822f14be8a2d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 11 Sep 2016 04:57:12 -0700 Subject: [PATCH] Make JobQueueGroup::push() update the queuesHaveJobs() cache This makes it so jobs can run sooner with $wgJobRunRate Bug: T145206 Change-Id: Ia7673f51312f90a696fa056bd3daf7f3f440782b --- includes/jobqueue/JobQueueGroup.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php index 8d575625d9..de5f4103ec 100644 --- a/includes/jobqueue/JobQueueGroup.php +++ b/includes/jobqueue/JobQueueGroup.php @@ -142,6 +142,20 @@ class JobQueueGroup { $this->cache->clear( 'queues-ready' ); } } + + $cache = ObjectCache::getLocalClusterInstance(); + $cache->set( + $cache->makeGlobalKey( 'jobqueue', $this->wiki, 'hasjobs', self::TYPE_ANY ), + 'true', + 15 + ); + if ( array_intersect( array_keys( $jobsByType ), $this->getDefaultQueueTypes() ) ) { + $cache->set( + $cache->makeGlobalKey( 'jobqueue', $this->wiki, 'hasjobs', self::TYPE_DEFAULT ), + 'true', + 15 + ); + } } /** @@ -298,8 +312,8 @@ class JobQueueGroup { * @since 1.23 */ public function queuesHaveJobs( $type = self::TYPE_ANY ) { - $key = wfMemcKey( 'jobqueue', 'queueshavejobs', $type ); $cache = ObjectCache::getLocalClusterInstance(); + $key = $cache->makeGlobalKey( 'jobqueue', $this->wiki, 'hasjobs', $type ); $value = $cache->get( $key ); if ( $value === false ) { -- 2.20.1