Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/226960
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(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/60/226960/1
diff --git a/globalcollect_gateway/scripts/orphans.php
b/globalcollect_gateway/scripts/orphans.php
index 1184e6a..64d0d67 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: newchange
Gerrit-Change-Id: Id03974324c0be0edf385d80aa168e11dc5d2b90f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits