Avoid triggering SiteConfiguration lookup in JobQueueGroup::push()
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 16 Sep 2016 18:16:19 +0000 (11:16 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 16 Sep 2016 18:16:19 +0000 (11:16 -0700)
Just use $wgJobTypesExcludedFromDefaultQueue directly

Bug: T145819
Change-Id: I0d978cdbef40ced98880c1a7d7524fd2b7438bfc

includes/jobqueue/JobQueueGroup.php

index de5f410..71d68d9 100644 (file)
@@ -120,6 +120,8 @@ class JobQueueGroup {
         * @return void
         */
        public function push( $jobs ) {
+               global $wgJobTypesExcludedFromDefaultQueue;
+
                $jobs = is_array( $jobs ) ? $jobs : [ $jobs ];
                if ( !count( $jobs ) ) {
                        return;
@@ -149,7 +151,7 @@ class JobQueueGroup {
                        'true',
                        15
                );
-               if ( array_intersect( array_keys( $jobsByType ), $this->getDefaultQueueTypes() ) ) {
+               if ( array_diff( array_keys( $jobsByType ), $wgJobTypesExcludedFromDefaultQueue ) ) {
                        $cache->set(
                                $cache->makeGlobalKey( 'jobqueue', $this->wiki, 'hasjobs', self::TYPE_DEFAULT ),
                                'true',