https://www.mediawiki.org/wiki/Special:Code/MediaWiki/105514
Revision: 105514 Author: khorn Date: 2011-12-08 03:52:33 +0000 (Thu, 08 Dec 2011) Log Message: ----------- MFT r105513 Modified Paths: -------------- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php Property Changed: ---------------- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php 2011-12-08 03:43:25 UTC (rev 105513) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php 2011-12-08 03:52:33 UTC (rev 105514) @@ -250,6 +250,14 @@ function stompFetchMessages( $queue, $selector = null, $limit = 50 ){ global $wgStompQueueName, $wgPendingStompQueueName, $wgLimboStompQueueName, $wgCCLimboStompQueueName; + static $selector_last = null; + if ( !is_null( $selector_last ) && $selector_last != $selector ){ + $renew = true; + } else { + $renew = false; + } + $selector_last = $selector; + switch($queue){ case 'pending': $queue = $wgPendingStompQueueName; @@ -266,22 +274,22 @@ break; } - //This needs to be renewed every time, or the selectors won't work. - //So says the internets, at least. - $stomp = getDIStompConnection( true ); + //This needs to be renewed every time we change the selectors. + $stomp = getDIStompConnection( $renew ); $properties = array( 'ack' => 'client' ); if ( !is_null( $selector ) ){ $properties['selector'] = $selector; } - $returned = $stomp->subscribe( '/queue/' . $queue, $properties ); + $stomp->subscribe( '/queue/' . $queue, $properties ); $message = $stomp->readFrame(); $return = array(); while ( !empty( $message ) && count( $return ) < $limit ) { $return[] = $message; + $stomp->subscribe( '/queue/' . $queue, $properties ); $message = $stomp->readFrame(); } Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php:99568 /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104194,104210,104243,104298,104362,104485,104503,104539,104587-104588,104611,104648,104933 + /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/activemq_stomp/activemq_stomp.php:99568 /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104194,104210,104243,104298,104362,104485,104503,104539,104587-104588,104611,104648,104933,105513 Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php 2011-12-08 03:43:25 UTC (rev 105513) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php 2011-12-08 03:52:33 UTC (rev 105514) @@ -73,9 +73,11 @@ $this->handled_ids[$correlation_id] = 'error'; } } + $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding. + $orphans = $this->getStompOrphans(); } - $this->addStompCorrelationIDToAckBucket( false, true ); //this just acks everything that's waiting for it. + $this->addStompCorrelationIDToAckBucket( false, true ); //ack all outstanding. //TODO: Make stats squirt out all over the place. $am = 0; @@ -113,15 +115,20 @@ if ( $correlation_id ) { $bucket[$correlation_id] = "'$correlation_id'"; //avoiding duplicates. $this->handled_ids[$correlation_id] = 'antimessage'; + echo "Added $correlation_id to the ack bucket : Total bucket count = " . count( $bucket ); } if ( count( $bucket ) && ( count( $bucket ) >= $count || $ackNow ) ){ //ack now. + echo 'Acking ' . count( $bucket ) . ' bucket messages.'; $selector = 'JMSCorrelationID IN (' . implode( ", ", $bucket ) . ')'; $ackMe = stompFetchMessages( 'cc-limbo', $selector, $count * 100 ); //This is outrageously high, but I just want to be reasonably sure we get all the matches. $retrieved_count = count( $ackMe ); if ( $retrieved_count ){ stompAckMessages( $ackMe ); $this->removed_message_count += $retrieved_count; + echo "Done acking $retrieved_count messages. "; + } else { + echo "Oh noes! No messages to ack for some reason..."; } $bucket = array(); } @@ -132,7 +139,7 @@ $selector = "antimessage = 'true'"; $antimessages = stompFetchMessages( 'cc-limbo', $selector, 1000 ); $count = 0; - while ( count( $antimessages ) ){ //if there's an antimessage, we can ack 'em all right now. + while ( count( $antimessages ) && $this->keepGoing() ){ //if there's an antimessage, we can ack 'em all right now. $count += count( $antimessages ); foreach ( $antimessages as $message ){ //add the correlation ID to the ack bucket. @@ -166,7 +173,13 @@ $elapsed = $this->now - $decoded['date']; if ( $elapsed > $time_buffer ){ //we got ourselves an orphan! - $orphans[$message->headers['antimessage']] = $decoded; + $correlation_id = $message->headers['correlation-id']; + $order_id = explode('-', $correlation_id); + $order_id = $order_id[1]; + $decoded['order_id'] = $order_id; + $decoded['i_order_id'] = $order_id; + $orphans[$correlation_id] = $decoded; + echo "\nFound an orphan! $correlation_id"; } } } @@ -261,6 +274,7 @@ * @return boolean True if the orphan has been rectified, false if not. */ function rectifyOrphan( $data, $query_contribution_tracking = true ){ + echo "\nRectifying Orphan " . $data['order_id']; $rectified = false; $this->adapter->loadDataAndReInit( $data, $query_contribution_tracking ); Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php:99568 /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500-103501,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104194,104210,104243,104298,104362,104485,104587,104611,104648,104791,104933 + /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php:99568 /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500-103501,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104194,104210,104243,104298,104362,104485,104587,104611,104648,104791,104933,105513 _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs