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

Change subject: Don't delete limbo messages until we've finished processing
......................................................................


Don't delete limbo messages until we've finished processing

Bug: T107852
Change-Id: If51e7a176bfeb8a975f093c07807f441edb0b9fe
---
M composer.lock
M gateway_common/DonationQueue.php
M globalcollect_gateway/scripts/orphans.php
3 files changed, 12 insertions(+), 6 deletions(-)

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



diff --git a/composer.lock b/composer.lock
index 1ad2936..6725511 100644
--- a/composer.lock
+++ b/composer.lock
@@ -53,7 +53,7 @@
             "source": {
                 "type": "git",
                 "url": 
"https://gerrit.wikimedia.org/r/p/wikimedia/fundraising/php-queue.git";,
-                "reference": "4f8d50b0bab4a2c3bfa1eb0ce584f198362ded61"
+                "reference": "4d0030a90c0b55c06ed82ccdb118cdf8899264fb"
             },
             "require": {
                 "clio/clio": "@stable",
diff --git a/gateway_common/DonationQueue.php b/gateway_common/DonationQueue.php
index 4080f6a..0f1c8a4 100644
--- a/gateway_common/DonationQueue.php
+++ b/gateway_common/DonationQueue.php
@@ -37,6 +37,15 @@
                return $backend->pop();
        }
 
+       public function peek( $queue ) {
+               if ( !GatewayAdapter::getGlobal( 'EnableQueue' ) ) {
+                       return;
+               }
+               $backend = $this->newBackend( $queue );
+
+               return $backend->peek();
+       }
+
        public function set( $correlationId, $transaction, $queue ) {
                if ( !GatewayAdapter::getGlobal( 'EnableQueue' ) ) {
                        return;
diff --git a/globalcollect_gateway/scripts/orphans.php 
b/globalcollect_gateway/scripts/orphans.php
index 4348c96..4e85182 100644
--- a/globalcollect_gateway/scripts/orphans.php
+++ b/globalcollect_gateway/scripts/orphans.php
@@ -227,7 +227,7 @@
                while ( !$queue_pool->isEmpty() ) {
                        $current_queue = $queue_pool->current();
                        try {
-                               $message = DonationQueue::instance()->pop( 
$current_queue );
+                               $message = DonationQueue::instance()->peek( 
$current_queue );
 
                                if ( !$message ) {
                                        $this->logger->info( "Emptied queue 
[{$current_queue}], removing from pool." );
@@ -239,6 +239,7 @@
                                if ( array_key_exists( $correlation_id, 
$this->handled_ids ) ) {
                                        // We already did this one, keep going. 
 It's fine to draw
                                        // again from the same queue.
+                                       DonationQueue::instance()->delete( 
$correlation_id, $current_queue );
                                        continue;
                                }
 
@@ -247,10 +248,6 @@
                                // chronological order.
                                $elapsed = $this->start_time - $message['date'];
                                if ( $elapsed < $time_buffer ) {
-                                       // Put it back!
-                                       DonationQueue::instance()->set(
-                                           $correlation_id, $message, 
$current_queue );
-
                                        $this->logger->info( "Exhausted new 
messages in [{$current_queue}], removing from pool..." );
                                        $queue_pool->dropCurrent();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If51e7a176bfeb8a975f093c07807f441edb0b9fe
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to