Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/53796
Change subject: [JobQueue] Added a function to purge the aggregator cache.
......................................................................
[JobQueue] Added a function to purge the aggregator cache.
Change-Id: If9eabf202c372d5c594f5faeb75265ff78104f7f
---
M includes/job/JobQueueAggregator.php
M includes/job/JobQueueAggregatorMemc.php
M includes/job/JobQueueAggregatorRedis.php
3 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/96/53796/1
diff --git a/includes/job/JobQueueAggregator.php
b/includes/job/JobQueueAggregator.php
index 3dba3c5..a8186ab 100644
--- a/includes/job/JobQueueAggregator.php
+++ b/includes/job/JobQueueAggregator.php
@@ -119,6 +119,23 @@
abstract protected function doGetAllReadyWikiQueues();
/**
+ * Purge all of the aggregator information
+ *
+ * @return bool Success
+ */
+ final public function purge() {
+ wfProfileIn( __METHOD__ );
+ $res = $this->doPurge();
+ wfProfileOut( __METHOD__ );
+ return $res;
+ }
+
+ /**
+ * @see JobQueueAggregator::purge()
+ */
+ abstract protected function doPurge();
+
+ /**
* Get all databases that have a pending job.
* This poll all the queues and is this expensive.
*
diff --git a/includes/job/JobQueueAggregatorMemc.php
b/includes/job/JobQueueAggregatorMemc.php
index 4b82cf9..15bb833 100644
--- a/includes/job/JobQueueAggregatorMemc.php
+++ b/includes/job/JobQueueAggregatorMemc.php
@@ -109,6 +109,13 @@
}
/**
+ * @see JobQueueAggregator::doPurge()
+ */
+ protected function doPurge() {
+ return $this->cache->delete( $this->getReadyQueueCacheKey() );
+ }
+
+ /**
* @return string
*/
private function getReadyQueueCacheKey() {
diff --git a/includes/job/JobQueueAggregatorRedis.php
b/includes/job/JobQueueAggregatorRedis.php
index 74e9171..c67e98c 100644
--- a/includes/job/JobQueueAggregatorRedis.php
+++ b/includes/job/JobQueueAggregatorRedis.php
@@ -120,6 +120,23 @@
}
/**
+ * @see JobQueueAggregator::doPurge()
+ */
+ protected function doPurge() {
+ $conn = $this->getConnection();
+ if ( !$conn ) {
+ return false;
+ }
+ try {
+ $conn->delete( $this->getReadyQueueKey() );
+ } catch ( RedisException $e ) {
+ $this->handleException( $conn, $e );
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Get a connection to the server that handles all sub-queues for this
queue
*
* @return Array (server name, Redis instance)
--
To view, visit https://gerrit.wikimedia.org/r/53796
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9eabf202c372d5c594f5faeb75265ff78104f7f
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