Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/104478
Change subject: Fixed locking in JobQueueAggregatorRedis
......................................................................
Fixed locking in JobQueueAggregatorRedis
* The old code would still bump the lock TTL on failure,
so if processes kept trying to acquire it and the one
that had it crashed, nothing would ever do anything.
Change-Id: If3fe7b75364204f399fb4caf8bd39204ab51b353
---
M includes/job/aggregator/JobQueueAggregatorRedis.php
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/78/104478/1
diff --git a/includes/job/aggregator/JobQueueAggregatorRedis.php
b/includes/job/aggregator/JobQueueAggregatorRedis.php
index 057a587..cc79164 100644
--- a/includes/job/aggregator/JobQueueAggregatorRedis.php
+++ b/includes/job/aggregator/JobQueueAggregatorRedis.php
@@ -104,9 +104,10 @@
}
} else { // cache miss
// Avoid duplicated effort
+ $rand = wfRandomString( 32 );
$conn->multi( Redis::MULTI );
- $conn->setnx( $this->getReadyQueueKey() .
":lock", 1 );
- $conn->expire( $this->getReadyQueueKey() .
":lock", 3600 );
+ $conn->setex( "{$rand}:lock", 3600, 1 );
+ $conn->renamenx( "{$rand}:lock",
$this->getReadyQueueKey() . ":lock" );
if ( $conn->exec() !== array( true, true ) ) {
// lock
return array(); // already in progress
}
--
To view, visit https://gerrit.wikimedia.org/r/104478
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If3fe7b75364204f399fb4caf8bd39204ab51b353
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