jenkins-bot has submitted this change and it was merged.

Change subject: Configurable queue mirroring
......................................................................


Configurable queue mirroring

Bug: T133195
Change-Id: I44a4d7be3fae359da4e63cdb0aabd09c0794ed1c
---
M extension.json
M gateway_common/DonationQueue.php
2 files changed, 10 insertions(+), 21 deletions(-)

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



diff --git a/extension.json b/extension.json
index 277a76a..77c5bab 100644
--- a/extension.json
+++ b/extension.json
@@ -409,6 +409,9 @@
                        "banner-history": [],
                        "_merge_strategy": "array_plus"
                },
+               "DonationInterfaceQueueMirrors": {
+                       "_merge_strategy": "array_plus"
+               },
                "DonationInterfaceCustomFiltersActionRanges": {
                        "process": [
                                0,
diff --git a/gateway_common/DonationQueue.php b/gateway_common/DonationQueue.php
index 17f773e..ec4ea1d 100644
--- a/gateway_common/DonationQueue.php
+++ b/gateway_common/DonationQueue.php
@@ -2,18 +2,6 @@
 
 class DonationQueue {
 
-       // Existing queues that should be copied to the new pending queue.
-       // TODO: should this be somewhere the consumer can see, so that we can
-       // point it at new queues one at a time?
-       static $oldPending = array(
-               'pending',
-               'globalcollect-cc-limbo'
-       );
-
-       // The new pending queue to copy to.
-       // TODO: this should all maybe be in config.
-       static $newPending = 'pending-new';
-
        protected static $instance;
 
        protected function __construct() {
@@ -89,20 +77,18 @@
        }
 
        /**
-        * Temporary measure to transition 'pending' from key/value ActiveMQ to 
a
-        * pure FIFO queue. Sends a copy of anything in $oldPending to 
$newPending,
-        * if $newPending is explicitly configured.
+        * Temporary measure to transition from key/value ActiveMQ to pure FIFO
+        * queues. Reads $wgDonationInterfaceQueueMirrors, where keys are 
original
+        * queue names and values are the queues to mirror to.
         *
         * @param array $message
         * @param string $queue
         */
        protected function mirror( $message, $queue ) {
-               global $wgDonationInterfaceQueues;
-               if (
-                       in_array( $queue, self::$oldPending ) &&
-                       array_key_exists( self::$newPending, 
$wgDonationInterfaceQueues )
-               ) {
-                       $this->newBackend( self::$newPending )->push( $message 
);
+               global $wgDonationInterfaceQueueMirrors;
+               if ( array_key_exists( $queue, $wgDonationInterfaceQueueMirrors 
) ) {
+                       $mirrorQueue = $wgDonationInterfaceQueueMirrors[$queue];
+                       $this->newBackend( $mirrorQueue )->push( $message );
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I44a4d7be3fae359da4e63cdb0aabd09c0794ed1c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@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