Merge "UserTest: Cover User::isIP and User::isValidUserName better"
[lhc/web/wiklou.git] / includes / jobqueue / JobQueueGroup.php
index 6591282..98a78c5 100644 (file)
@@ -106,13 +106,12 @@ class JobQueueGroup {
         *
         * @param Job|array $jobs A single Job or a list of Jobs
         * @throws MWException
-        * @return bool
-        * @todo Return value here is not useful
+        * @return void
         */
        public function push( $jobs ) {
                $jobs = is_array( $jobs ) ? $jobs : array( $jobs );
                if ( !count( $jobs ) ) {
-                       return true;
+                       return;
                }
 
                $jobsByType = array(); // (job type => list of jobs)
@@ -135,8 +134,6 @@ class JobQueueGroup {
                                $this->cache->clear( 'queues-ready' );
                        }
                }
-
-               return true;
        }
 
        /**
@@ -254,7 +251,7 @@ class JobQueueGroup {
        /**
         * Check if there are any queues with jobs (this is cached)
         *
-        * @param integer $type JobQueueGroup::TYPE_* constant
+        * @param int $type JobQueueGroup::TYPE_* constant
         * @return bool
         * @since 1.23
         */
@@ -392,6 +389,10 @@ class JobQueueGroup {
                        }
                }
 
+               if ( $count === 0 ) {
+                       return $count; // nothing to update
+               }
+
                $wgMemc->merge( $key, function ( $cache, $key, $lastRuns ) use ( $tasksRun ) {
                        if ( is_array( $lastRuns ) ) {
                                foreach ( $tasksRun as $type => $tasks ) {
@@ -414,7 +415,7 @@ class JobQueueGroup {
        }
 
        /**
-        * @param $name string
+        * @param string $name
         * @return mixed
         */
        private function getCachedConfigVar( $name ) {