[JobQueue] Simplified a bit of code in JobQueueRedis.
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 4 Apr 2013 05:19:35 +0000 (22:19 -0700)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 18 Apr 2013 03:03:08 +0000 (03:03 +0000)
Change-Id: Ia0329a9721b126a3573cfee0d67c9a54c911196f

includes/job/JobQueueRedis.php

index 6947f73..d30e20e 100644 (file)
@@ -467,13 +467,10 @@ LUA;
         * @return bool
         */
        protected function doIsRootJobOldDuplicate( Job $job ) {
-               $params = $job->getParams();
-               if ( !isset( $params['rootJobSignature'] ) ) {
+               if ( !$job->hasRootJobParams() ) {
                        return false; // job has no de-deplication info
-               } elseif ( !isset( $params['rootJobTimestamp'] ) ) {
-                       wfDebugLog( 'JobQueueRedis', "Cannot check root job; missing 'rootJobTimestamp'." );
-                       return false;
                }
+               $params = $job->getRootJobParams();
 
                $conn = $this->getConnection();
                try {
@@ -493,9 +490,6 @@ LUA;
         */
        public function getAllQueuedJobs() {
                $conn = $this->getConnection();
-               if ( !$conn ) {
-                       throw new MWException( "Unable to connect to redis server." );
-               }
                try {
                        $that = $this;
                        return new MappedIterator(
@@ -515,9 +509,6 @@ LUA;
         */
        public function getAllDelayedJobs() {
                $conn = $this->getConnection();
-               if ( !$conn ) {
-                       throw new MWException( "Unable to connect to redis server." );
-               }
                try {
                        $that = $this;
                        return new MappedIterator( // delayed jobs