Cdentinger has uploaded a new change for review.

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

Change subject: WIP: Write all limbo queues to new pending queue.
......................................................................

WIP: Write all limbo queues to new pending queue.

TODO: on/off switch. Localsettings?

Bug: T133195
Change-Id: I3e4b7952d12adebd6ddf655187fff5b6b2a0e2e3
---
M gateway_common/DonationQueue.php
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/97/299797/1

diff --git a/gateway_common/DonationQueue.php b/gateway_common/DonationQueue.php
index 5ca49c1..f1076d1 100644
--- a/gateway_common/DonationQueue.php
+++ b/gateway_common/DonationQueue.php
@@ -1,6 +1,20 @@
 <?php
 
 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 $limboToPending = [
+               'limbo',
+               'pending',
+               'globalcollect-cc-limbo'
+       ];
+
+       // The new pending queue to copy to.
+       // TODO: this should all maybe be in config.
+       static $newPendingQueue = 'pending-new';
+
        protected static $instance;
 
        protected function __construct() {
@@ -26,6 +40,11 @@
                $properties = $this->buildHeaders( $transaction );
                $message = $this->buildBody( $transaction );
                $this->newBackend( $queue )->push( $message, $properties );
+
+               // FIXME: hack for new queue, remove
+               if ( in_array( $queue, self::$limboToPending ) ) {
+                       $this->newBackend( self::$newPendingQueue )->push( 
$message, $properties );
+               }
        }
 
        public function pop( $queue ) {
@@ -53,6 +72,11 @@
                $properties = $this->buildHeaders( $transaction );
                $message = $this->buildBody( $transaction );
                $this->newBackend( $queue )->set( $correlationId, $message, 
$properties );
+
+               // FIXME: hack for new queue, remove
+               if ( in_array( $queue, self::$limboToPending ) ) {
+                       $this->newBackend( self::$newPendingQueue )->set( 
$correlationId, $message, $properties );
+               }
        }
 
        public function get( $correlationId, $queue ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e4b7952d12adebd6ddf655187fff5b6b2a0e2e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Cdentinger <cdentin...@wikimedia.org>

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

Reply via email to