Track the types of queues in the redis queue aggregator
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Jun 2014 20:53:17 +0000 (13:53 -0700)
committerOri.livneh <ori@wikimedia.org>
Wed, 4 Jun 2014 22:29:51 +0000 (22:29 +0000)
* This tracks all queue types in one simple location that
  can be inspected without using MediaWiki.

Change-Id: I197664b9aa620b29f1400e5a60c55a301348120d

includes/jobqueue/aggregator/JobQueueAggregatorRedis.php

index 2aec3c9..896aac4 100644 (file)
@@ -75,7 +75,10 @@ class JobQueueAggregatorRedis extends JobQueueAggregator {
                        return false;
                }
                try {
+                       $conn->multi( Redis::PIPELINE );
+                       $conn->hSetNx( $this->getQueueTypesKey(), $type, 'enabled' );
                        $conn->hSet( $this->getReadyQueueKey(), $this->encQueueName( $type, $wiki ), time() );
+                       $conn->exec();
 
                        return true;
                } catch ( RedisException $e ) {
@@ -185,6 +188,13 @@ class JobQueueAggregatorRedis extends JobQueueAggregator {
                return "jobqueue:aggregator:h-ready-queues:v1"; // global
        }
 
+       /**
+        * @return string
+        */
+       private function getQueueTypesKey() {
+               return "jobqueue:aggregator:h-queue-types:v1"; // global
+       }
+
        /**
         * @param string $type
         * @param string $wiki