Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252581

Change subject: Make JobQueueAggregator::doNotifyQueueNonEmpty() avoid queries
......................................................................

Make JobQueueAggregator::doNotifyQueueNonEmpty() avoid queries

Avoid 2 of the 3 queries in doNotifyQueueNonEmpty(), the ones
that register the queue, once such a command has been done in
the request already.

Change-Id: I58553f0c56660f05a3e3000065270baebb8cbb62
---
M includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/81/252581/1

diff --git a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php 
b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
index f8a0040..250947a 100644
--- a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
+++ b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
@@ -31,9 +31,10 @@
 class JobQueueAggregatorRedis extends JobQueueAggregator {
        /** @var RedisConnectionPool */
        protected $redisPool;
-
        /** @var array List of Redis server addresses */
        protected $servers;
+       /** @var bool */
+       protected $registeredQueue = false;
 
        /**
         * @param array $params Possible keys:
@@ -80,11 +81,16 @@
                }
                try {
                        $conn->multi( Redis::PIPELINE );
-                       $conn->hSetNx( $this->getQueueTypesKey(), $type, 
'enabled' );
-                       $conn->sAdd( $this->getWikiSetKey(), $wiki );
+                       if ( !$this->registeredQueue ) {
+                               // Make sure the queue is registered as existing
+                               $conn->hSetNx( $this->getQueueTypesKey(), 
$type, 'enabled' );
+                               $conn->sAdd( $this->getWikiSetKey(), $wiki );
+                       }
                        $conn->hSet( $this->getReadyQueueKey(), 
$this->encQueueName( $type, $wiki ), time() );
                        $conn->exec();
 
+                       $this->registeredQueue = true;
+
                        return true;
                } catch ( RedisException $e ) {
                        $this->handleException( $conn, $e );

-- 
To view, visit https://gerrit.wikimedia.org/r/252581
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58553f0c56660f05a3e3000065270baebb8cbb62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to