Update ternary notation
[lhc/web/wiklou.git] / includes / job / JobQueueGroup.php
index 0203ac8..a3ec8a7 100644 (file)
@@ -111,6 +111,9 @@ class JobQueueGroup {
         */
        public function push( $jobs ) {
                $jobs = is_array( $jobs ) ? $jobs : array( $jobs );
+               if ( !count( $jobs ) ) {
+                       return true;
+               }
 
                $jobsByType = array(); // (job type => list of jobs)
                foreach ( $jobs as $job ) {
@@ -340,9 +343,11 @@ class JobQueueGroup {
                        return $this->cache->get( 'isDeprioritized', $type );
                }
                if ( $type === 'refreshLinks2' ) {
-                       // Don't keep converting refreshLinks2 => refreshLinks jobs if the
+                       // Don't keep converting refreshLinksPartition => refreshLinks jobs if the
                        // later jobs have not been done yet. This helps throttle queue spam.
-                       $deprioritized = !$this->get( 'refreshLinks' )->isEmpty();
+                       // @TODO: this is mostly a WMF-specific hack and should be removed when
+                       // refreshLinks2 jobs are drained.
+                       $deprioritized = !$this->get( 'refreshLinks' )->getSize() > 10000;
                        $this->cache->set( 'isDeprioritized', $type, $deprioritized );
 
                        return $deprioritized;