Aaron Schulz has submitted this change and it was merged.

Change subject: Avoid doNotifyQueueEmpty() race conditions for Redis
......................................................................


Avoid doNotifyQueueEmpty() race conditions for Redis

Previously, races could cause queues to be seen as empty
and ignored when they actually have jobs in them.

Change-Id: I6cdf5c1fbd33c9ed7982e5d2d494974b1d7e09fd
---
M includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php 
b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
index 6c49646..f8a0040 100644
--- a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
+++ b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
@@ -59,7 +59,11 @@
                        return false;
                }
                try {
-                       $conn->hDel( $this->getReadyQueueKey(), 
$this->encQueueName( $type, $wiki ) );
+                       // Make sure doNotifyQueueNonEmpty() takes precedence 
to avoid races
+                       $conn->watch( $this->getReadyQueueKey() );
+                       $conn->multi()
+                               ->hDel( $this->getReadyQueueKey(), 
$this->encQueueName( $type, $wiki ) )
+                               ->exec();
 
                        return true;
                } catch ( RedisException $e ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6cdf5c1fbd33c9ed7982e5d2d494974b1d7e09fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.6
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to