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

Change subject: Move deleteMessage out of legacy antimessage function
......................................................................


Move deleteMessage out of legacy antimessage function

Do the new thing without coupling to the old one.

Change-Id: Id03974324c0be0edf385d80aa168e11dc5d2b90f
---
M globalcollect_gateway/scripts/orphans.php
1 file changed, 13 insertions(+), 4 deletions(-)

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



diff --git a/globalcollect_gateway/scripts/orphans.php 
b/globalcollect_gateway/scripts/orphans.php
index 5fed8e9..58384c4 100644
--- a/globalcollect_gateway/scripts/orphans.php
+++ b/globalcollect_gateway/scripts/orphans.php
@@ -163,16 +163,18 @@
                return $elapsed;
        }
 
+       protected function deleteMessage( $correlation_id, $queue ) {
+           $this->handled_ids[$correlation_id] = 'antimessage';
+
+           DonationQueue::instance()->delete( $correlation_id, $queue );
+       }
+
        function addStompCorrelationIDToAckBucket( $correlation_id, $ackNow = 
false ){
                static $bucket = array();
                $count = 50; //sure. Why not?
                if ( $correlation_id ) {
                        $bucket[$correlation_id] = "'$correlation_id'"; 
//avoiding duplicates.
                        $this->handled_ids[$correlation_id] = 'antimessage';
-
-                       // Delete from Memcache
-                       DonationQueue::instance()->delete(
-                               $correlation_id, 
GlobalCollectAdapter::GC_CC_LIMBO_QUEUE );
                }
                if ( count( $bucket ) && ( count( $bucket ) >= $count || 
$ackNow ) ){
                        //ack now.
@@ -192,6 +194,7 @@
 
        }
 
+       // TODO: remove STOMP function
        function handleStompAntiMessages(){
                $selector = "antimessage = 'true' AND gateway='globalcollect'";
                $antimessages = stompFetchMessages( 'cc-limbo', $selector, 1000 
);
@@ -203,6 +206,9 @@
                                //add the correlation ID to the ack bucket. 
                                if (array_key_exists('correlation-id', 
$message->headers)) {
                                        
$this->addStompCorrelationIDToAckBucket( $message->headers['correlation-id'] );
+
+                                       // mirror to new thing
+                                       $this->deleteMessage( 
$message->headers['correlation-id'], GlobalCollectAdapter::GC_CC_LIMBO_QUEUE );
                                } else {
                                        echo 'The STOMP message ' . 
$message->headers['message-id'] . " has no correlation ID!\n";
                                }
@@ -275,6 +281,9 @@
                                unset( $orphans[$cid] );
                                $this->addStompCorrelationIDToAckBucket( $cid );
                                $this->handled_ids[ $cid ] = 'false_orphan';
+
+                               // mirror to new thing
+                               $this->deleteMessage( $cid, 
GlobalCollectAdapter::GC_CC_LIMBO_QUEUE );
                        }
                }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id03974324c0be0edf385d80aa168e11dc5d2b90f
Gerrit-PatchSet: 2
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