From da8a0f7d6d82bc8e2988d8c8c31171aff1ebb487 Mon Sep 17 00:00:00 2001 From: Noeli Date: Thu, 15 Aug 2024 15:02:56 -0400 Subject: [PATCH] #557 fix high memory and cpu usage in cron job --- Cron/CancelPendingOrders.php | 5 +++++ Setup/UpgradeSchema.php | 2 +- composer.json | 2 +- etc/module.xml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cron/CancelPendingOrders.php b/Cron/CancelPendingOrders.php index b5b28372..b6691f56 100644 --- a/Cron/CancelPendingOrders.php +++ b/Cron/CancelPendingOrders.php @@ -100,12 +100,17 @@ public function execute() { $this->logger->info("Cronjob: Cancel Pending Order Cron started."); $dateTimeCheck = date('Y-m-d H:i:s', strtotime('-' . $this->pendingOrderTimeout . ' minutes')); + $minTimeCheck = date('Y-m-d H:i:s', strtotime('-10 days')); $sortOrder = $this->sortOrderBuilder->setField('entity_id')->setDirection('DESC')->create(); $searchCriteria = $this->searchCriteriaBuilder ->addFilter( 'updated_at', $dateTimeCheck, 'lt' + )->addFilter( + 'updated_at', + $minTimeCheck, + 'gt' )->addFilter( 'status', static::STATUS_PENDING, diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index c93f89a6..be0690ed 100755 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -75,7 +75,7 @@ public function upgrade( } } - $tableName = $setup->getTable(OrderLink::TABLE_NAME); + $tableName = $setup->getTable('sales_order'); if ($setup->getConnection()->isTableExists($tableName) == true) { $setup->getConnection()->addColumn( diff --git a/composer.json b/composer.json index 046fcce3..a053dafd 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "razorpay/magento", "description": "Razorpay Magento 2.0 plugin for accepting payments.", - "version": "4.1.6", + "version": "4.1.7", "require": { "php": "7.*|^8.1", "razorpay/razorpay": "2.*" diff --git a/etc/module.xml b/etc/module.xml index e5c05d79..46d7b7b2 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +