[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Remove all traces of stomp pending queue
jenkins-bot has submitted this change and it was merged. Change subject: Remove all traces of stomp pending queue .. Remove all traces of stomp pending queue DEPLOYMENT NOTE: Redis queue is now just called 'pending' Bug: T131274 Change-Id: If20b52465bc8f27e4458361a2ce93e63ae8efd9e --- M Core/DataStores/PendingDatabase.php M Core/Jobs/DeletePendingJob.php M Core/Listeners/ListenerBase.php M Maintenance/ConsumePendingQueue.php M Maintenance/CreateIpnMessagesFromPendingDb.php M PaymentProviders/Adyen/AdyenListener.php M PaymentProviders/Adyen/Jobs/ProcessCaptureRequestJob.php M PaymentProviders/Adyen/Jobs/RecordCaptureJob.php M PaymentProviders/Adyen/Tests/config_test.yaml M PaymentProviders/Amazon/ExpatriatedMessages/PaymentCapture.php M PaymentProviders/AstroPay/ExpatriatedMessages/AstroPayMessage.php M SmashPig.yaml M Tests/PendingQueueConsumerTest.php 13 files changed, 26 insertions(+), 110 deletions(-) Approvals: Awight: Looks good to me, approved jenkins-bot: Verified diff --git a/Core/DataStores/PendingDatabase.php b/Core/DataStores/PendingDatabase.php index 1c30f55..c006595 100644 --- a/Core/DataStores/PendingDatabase.php +++ b/Core/DataStores/PendingDatabase.php @@ -85,11 +85,7 @@ where gateway = :gateway and order_id = :order_id limit 1' ); - if ( !$prepared ) { - // TODO: remove after transition to new pending queue - // database exists but table is not yet set up - return null; - } + $prepared->bindValue( ':gateway', $gatewayName, PDO::PARAM_STR ); $prepared->bindValue( ':order_id', $orderId, PDO::PARAM_STR ); $prepared->execute(); @@ -175,57 +171,6 @@ $message = json_decode( $row['message'], true ); $message['pending_id'] = $row['id']; return $message; - } - - /** -* Ensure a smooth transition of pending message from ActiveMQ to database. -* Log notices if entries differ between queue and db. -* TODO: remove when ActiveMQ is gone -* -* @param DonationInterfaceMessage|null $queueMessage Message from ActiveMQ -* @param array|null $dbMessage Normalized message from pending DB -*/ - public static function comparePending( $queueMessage, $dbMessage ) { - if ( $dbMessage ) { - $id = $dbMessage['gateway'] . '-' . $dbMessage['order_id']; - } else if ( $queueMessage ) { - $id = $queueMessage->gateway . '-' . $queueMessage->order_id; - } else { - // neither exists, nothing to log - return; - } - $logger = Logger::getTaggedLogger( 'PendingComparison' ); - - if ( $queueMessage && $dbMessage ) { - $queueData = json_decode( $queueMessage->toJson(), true ); - unset( $queueData['correlationId'] ); - unset( $queueData['propertiesExportedAsKeys'] ); - unset( $queueData['propertiesExcludedFromExport'] ); - foreach ( array_keys( $queueData ) as $key ) { - if ( $queueData[$key] === '' && !isset( $dbMessage[$key] ) ) { - unset ( $queueData[$key] ); - } - } - $differences = array_diff_assoc( $queueData, $dbMessage ); - if ( $differences ) { - $logger->notice( - "Pending message for $id " . - 'differs between ActiveMQ and pending database: ' . - json_encode( $differences, true ) - ); - } - } else if ( $queueMessage && !$dbMessage ) { - $logger->notice( - "Found pending message for $id " . - 'in ActiveMQ but not in pending database.' - ); - } else if ( $dbMessage && !$queueMessage ) { - $logger->notice( - "Found pending message for $id " . - 'in pending database but not in ActiveMQ: ' . - json_encode( $dbMessage ) - ); - } } /** diff --git a/Core/Jobs/DeletePendingJob.php b/Core/Jobs/DeletePendingJob.php index 6a10e67..6210fa8 100644 --- a/Core/Jobs/DeletePendingJob.php +++ b/Core/Jobs/DeletePendingJob.php @@ -4,7 +4,7 @@ use SmashPig\Core\Logging\Logger; /** - * Job
[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Remove all traces of stomp pending queue
Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/310665 Change subject: Remove all traces of stomp pending queue .. Remove all traces of stomp pending queue DEPLOYMENT NOTE: Redis queue is now just called 'pending' Bug: T131274 Change-Id: If20b52465bc8f27e4458361a2ce93e63ae8efd9e --- M Core/Jobs/DeletePendingJob.php M Maintenance/ConsumePendingQueue.php M SmashPig.yaml 3 files changed, 6 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig refs/changes/65/310665/1 diff --git a/Core/Jobs/DeletePendingJob.php b/Core/Jobs/DeletePendingJob.php index 6a10e67..8a55b8d 100644 --- a/Core/Jobs/DeletePendingJob.php +++ b/Core/Jobs/DeletePendingJob.php @@ -4,7 +4,7 @@ use SmashPig\Core\Logging\Logger; /** - * Job that deletes donor information from the pending data stores. + * Job that deletes donor information from the pending database. * Used when we get a notification of payment failure. */ class DeletePendingJob extends RunnableJob { @@ -38,14 +38,10 @@ "and order ID='{$this->order_id}'" ); $db = PendingDatabase::get(); - if ( $db ) { - $dbMessage = $db->fetchMessageByGatewayOrderId( - $this->gateway, $this->order_id - ); - if ( $dbMessage ) { - $db->deleteMessage( $dbMessage ); - } - } + $db->deleteMessage( array( + 'gateway' => $this->gateway, + 'order_id' => $this->order_id, + ) ); return true; } } diff --git a/Maintenance/ConsumePendingQueue.php b/Maintenance/ConsumePendingQueue.php index 92acc5a..197e319 100644 --- a/Maintenance/ConsumePendingQueue.php +++ b/Maintenance/ConsumePendingQueue.php @@ -21,7 +21,7 @@ public function __construct() { parent::__construct(); - $this->addOption( 'queue', 'queue name to consume from', 'pending-new' ); + $this->addOption( 'queue', 'queue name to consume from', 'pending' ); $this->addOption( 'time-limit', 'Try to keep execution under seconds', 60, 't' ); $this->addOption( 'max-messages', 'At most consume messages', 0, 'm' ); } diff --git a/SmashPig.yaml b/SmashPig.yaml index ca0a795..b8a4070 100644 --- a/SmashPig.yaml +++ b/SmashPig.yaml @@ -37,11 +37,6 @@ queue: payments-antifraud pending: -class: SmashPig\Core\DataStores\StompDataStore -constructor-parameters: -- pending - -pending-new: class: PHPQueue\Backend\Predis constructor-parameters: - @@ -145,8 +140,6 @@ limbo: /queue/limbo verified: /queue/donations failed: /queue/failed -pending: /queue/pending -pending-damaged: /queue/pending-damaged recurring: /queue/donations_recurring refund: /queue/refund jobs: /queue/job-requests -- To view, visit https://gerrit.wikimedia.org/r/310665 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If20b52465bc8f27e4458361a2ce93e63ae8efd9e Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/SmashPig Gerrit-Branch: master Gerrit-Owner: Ejegg___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits