Mwalker has uploaded a new change for review.

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


Change subject: Fixing a Stomp Error
......................................................................

Fixing a Stomp Error

Turns out that sometimes STOMP will return the last object
even if it has already been ACK'd if you SUbSCRIBE again.

Fixed this by fixing a bug in the reconnection logic.

Change-Id: I01ec94e7aca35c5b47b365963174d6d181c3b656
---
M SmashPig/Core/DataStores/StompDataStore.php
1 file changed, 13 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/PaymentsListeners 
refs/changes/79/67179/1

diff --git a/SmashPig/Core/DataStores/StompDataStore.php 
b/SmashPig/Core/DataStores/StompDataStore.php
index 491c14e..dfc59cf 100644
--- a/SmashPig/Core/DataStores/StompDataStore.php
+++ b/SmashPig/Core/DataStores/StompDataStore.php
@@ -258,7 +258,13 @@
                $this->createSubscription( $type, $id );
 
                Logger::debug( "Pulling new object from queue" );
-               $this->queueMsg = $this->stompObj->readFrame();
+               try {
+                       $this->queueMsg = $this->stompObj->readFrame();
+               } catch ( \Exception $ex ) {
+                       Logger::error( "STOMP threw an unexpected exception on 
readFrame()", null, $ex );
+                       $this->queueMsg = null;
+               }
+
                if ( $this->queueMsg ) {
                        if ( $checkTail && strpos(
                                        $this->queueMsg->headers[ 'message-id' 
],
@@ -289,12 +295,17 @@
         */
        protected function createSubscription( $type, $id ) {
                static $sType, $sId;
-               $properties = array();
+               $properties = array(
+                       'ack' => 'client-individual',
+               );
 
                if ( $this->subscribed && ( ( $sType !== $type ) || ( $sId !== 
$id ) ) ) {
                        $this->deleteSubscription();
                }
 
+               $sType = $type;
+               $sId = $id;
+
                if ( $type ) {
                        $properties[ 'php-message-class' ] = $type;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01ec94e7aca35c5b47b365963174d6d181c3b656
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/PaymentsListeners
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>

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

Reply via email to