Skip to content

Commit dcfc7c8

Browse files
committed
ACP2E-3493: Expired persistent quotes are not cleaned up by a cron job sales_clean_quotes
- Fixed the CR comments.
1 parent c1393c6 commit dcfc7c8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/Persistent/Observer/ClearExpiredCronJobObserver.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Cron\Model\Schedule;
1111
use Magento\Persistent\Model\DeleteExpiredQuoteFactory;
12-
use Magento\Framework\App\ObjectManager;
1312
use Magento\Persistent\Model\SessionFactory;
1413
use Magento\Store\Model\ResourceModel\Website\CollectionFactory;
1514

@@ -39,17 +38,16 @@ class ClearExpiredCronJobObserver
3938
/**
4039
* @param CollectionFactory $websiteCollectionFactory
4140
* @param SessionFactory $sessionFactory
42-
* @param DeleteExpiredQuoteFactory|null $deleteExpiredQuoteFactory
41+
* @param DeleteExpiredQuoteFactory $deleteExpiredQuoteFactory
4342
*/
4443
public function __construct(
4544
CollectionFactory $websiteCollectionFactory,
4645
SessionFactory $sessionFactory,
47-
DeleteExpiredQuoteFactory $deleteExpiredQuoteFactory = null
46+
DeleteExpiredQuoteFactory $deleteExpiredQuoteFactory
4847
) {
4948
$this->_websiteCollectionFactory = $websiteCollectionFactory;
5049
$this->_sessionFactory = $sessionFactory;
51-
$this->deleteExpiredQuoteFactory = $deleteExpiredQuoteFactory ?:
52-
ObjectManager::getInstance()->get(DeleteExpiredQuoteFactory::class);
50+
$this->deleteExpiredQuoteFactory = $deleteExpiredQuoteFactory;
5351
}
5452

5553
/**
@@ -66,9 +64,10 @@ public function execute(Schedule $schedule)
6664
return $this;
6765
}
6866

67+
$deleteExpiredQuote = $this->deleteExpiredQuoteFactory->create();
6968
foreach ($websiteIds as $websiteId) {
7069
$this->_sessionFactory->create()->deleteExpired($websiteId);
71-
$this->deleteExpiredQuoteFactory->create()->deleteExpiredQuote($websiteId);
70+
$deleteExpiredQuote->deleteExpiredQuote($websiteId);
7271
}
7372

7473
return $this;

0 commit comments

Comments
 (0)