Also set the queue types map when rebuilding the ready queue map
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 5 Jun 2014 16:24:59 +0000 (09:24 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 5 Jun 2014 16:24:59 +0000 (09:24 -0700)
Change-Id: I0686859541661a22131c387d8fac6dc7b074c18c

includes/jobqueue/aggregator/JobQueueAggregatorRedis.php

index 896aac4..df9ae39 100644 (file)
@@ -118,16 +118,19 @@ class JobQueueAggregatorRedis extends JobQueueAggregator {
 
                                $pendingDBs = $this->findPendingWikiQueues(); // (type => list of wikis)
 
-                               $conn->delete( $this->getReadyQueueKey() . ":lock" ); // unlock
-
+                               $conn->multi( Redis::PIPELINE );
                                $now = time();
                                $map = array();
                                foreach ( $pendingDBs as $type => $wikis ) {
+                                       $conn->hSetNx( $this->getQueueTypesKey(), $type, 'enabled' );
                                        foreach ( $wikis as $wiki ) {
                                                $map[$this->encQueueName( $type, $wiki )] = $now;
                                        }
                                }
                                $conn->hMSet( $this->getReadyQueueKey(), $map );
+                               $conn->exec();
+
+                               $conn->delete( $this->getReadyQueueKey() . ":lock" ); // unlock
                        }
 
                        return $pendingDBs;
@@ -145,6 +148,7 @@ class JobQueueAggregatorRedis extends JobQueueAggregator {
                }
                try {
                        $conn->delete( $this->getReadyQueueKey() );
+                       // leave key at getQueueTypesKey() alone
                } catch ( RedisException $e ) {
                        $this->handleException( $conn, $e );