r105640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105639‎ | r105640 | r105641 >
Date:02:20, 9 December 2011
Author:khorn
Status:ok
Tags:
Comment:
More command line orphan stomp maintenance tweaks.
Modified paths:
  • /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php
@@ -6,7 +6,7 @@
77
88 $IP = getenv( 'MW_INSTALL_PATH' );
99 if ( $IP === false ) {
10 - $IP = dirname( _FILE_ ) . '/../..';
 10+ $IP = dirname( _FILE_ ) . '/../../../..';
1111 }
1212
1313 //If you get errors on this next line, set (and export) your MW_INSTALL_PATH var.
@@ -62,21 +62,23 @@
6363 $this->handleStompAntiMessages();
6464 $this->adapter->log( 'Removed ' . $this->removed_message_count . ' messages and antimessages.' );
6565
66 - //Pull a batch of CC orphans, keeping in mind that Things May Have Happened in the small slice of time since we handled the antimessages.
67 - $orphans = $this->getStompOrphans();
68 - while ( count( $orphans ) && $this->keepGoing() ){
69 - //..do stuff.
70 - foreach ( $orphans as $correlation_id => $orphan ) {
71 - //process
72 - if ( $this->rectifyOrphan( $orphan ) ){
73 - $this->addStompCorrelationIDToAckBucket( $correlation_id );
74 - $this->handled_ids[$correlation_id] = 'rectified';
75 - } else {
76 - $this->handled_ids[$correlation_id] = 'error';
 66+ if ( $this->keepGoing() ){
 67+ //Pull a batch of CC orphans, keeping in mind that Things May Have Happened in the small slice of time since we handled the antimessages.
 68+ $orphans = $this->getStompOrphans();
 69+ while ( count( $orphans ) && $this->keepGoing() ){
 70+ //..do stuff.
 71+ foreach ( $orphans as $correlation_id => $orphan ) {
 72+ //process
 73+ if ( $this->rectifyOrphan( $orphan ) ){
 74+ $this->addStompCorrelationIDToAckBucket( $correlation_id );
 75+ $this->handled_ids[$correlation_id] = 'rectified';
 76+ } else {
 77+ $this->handled_ids[$correlation_id] = 'error';
 78+ }
7779 }
 80+ $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding.
 81+ $orphans = $this->getStompOrphans();
7882 }
79 - $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding.
80 - $orphans = $this->getStompOrphans();
8183 }
8284
8385 $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding.
@@ -159,6 +161,7 @@
160162 echo 'The STOMP message ' . $message->headers['message-id'] . " has no correlation ID!\n";
161163 }
162164 }
 165+ $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding.
163166 $antimessages = stompFetchMessages( 'cc-limbo', $selector, 1000 );
164167 }
165168 $this->addStompCorrelationIDToAckBucket( false, true ); //this just acks everything that's waiting for it.
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -1153,23 +1153,17 @@
11541154 if ( $is_orphan ){
11551155 //save stats.
11561156 if (!isset($this->orphanstats) || !isset( $this->orphanstats[$original_status_code] ) ){
1157 - $this->orphanstats[$original_status_code] = 0;
 1157+ $this->orphanstats[$original_status_code] = 1;
11581158 } else {
11591159 $this->orphanstats[$original_status_code] += 1;
1160 - }
1161 -
1162 - if ( $original_status_code > 70 && !$gotCVV ){
1163 - $problemflag = true;
1164 - $problemmessage = "Unable to retrieve orphan cvv/avs results (Communication problem?).";
1165 - }
1166 -
 1160+ }
11671161 }
11681162 if (!$order_status_results){
11691163 $problemflag = true;
11701164 $problemmessage = "We don't have a Transaction WMF Status after doing a GET_ORDERSTATUS.";
11711165 }
11721166 switch ( $order_status_results ){
1173 - case 'failed' :
 1167+ case 'failed' :
11741168 case 'revised' :
11751169 $add_antimessage = true;
11761170 $cancelflag = true; //makes sure we don't try to confirm.
@@ -1179,6 +1173,11 @@
11801174 $problemmessage = "GET_ORDERSTATUS reports that the payment is already complete.";
11811175 $add_antimessage = true;
11821176 break;
 1177+ case 'pending' :
 1178+ if ( $is_orphan && !$gotCVV ){
 1179+ $problemflag = true;
 1180+ $problemmessage = "Unable to retrieve orphan cvv/avs results (Communication problem?).";
 1181+ }
11831182 }
11841183 }
11851184
Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
@@ -230,7 +230,7 @@
231231 'fee' => '0',
232232 'gross' => $transaction['amount'],
233233 'net' => $transaction['amount'],
234 - 'date' => $transaction['date'],
 234+ 'date' => ( int ) $transaction['date'],
235235 );
236236
237237 return $message;

Follow-up revisions

RevisionCommit summaryAuthorDate
r105642Adding an important comment. followup r105640khorn02:28, 9 December 2011
r105643MFT r105640, r105642khorn02:54, 9 December 2011

Status & tagging log