From 376e35b24c4499298ce5281fdd93ab62654273d1 Mon Sep 17 00:00:00 2001 From: "markl@room40.com.au" Date: Thu, 20 Aug 2020 21:52:32 +1000 Subject: [PATCH] Set all instances of cache context to be transient --- app/code/Magento/Catalog/Model/Indexer/Category/Flat.php | 2 +- app/code/Magento/Catalog/Model/Indexer/Category/Product.php | 2 +- .../Catalog/Model/Indexer/Category/Product/Action/Rows.php | 2 +- .../Catalog/Model/Indexer/Product/Category/Action/Rows.php | 2 +- app/code/Magento/Catalog/Model/Indexer/Product/Eav.php | 2 +- app/code/Magento/Catalog/Model/Indexer/Product/Flat.php | 2 +- app/code/Magento/CatalogInventory/Model/Indexer/Stock.php | 2 +- app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php | 2 +- app/etc/di.xml | 1 + 9 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php index 320d86a7aed44..4e5e8f91d4b74 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php @@ -115,7 +115,7 @@ public function executeRow($id) protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product.php index c18404bda1fc8..dcc9189d5ef1f 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product.php @@ -156,7 +156,7 @@ protected function executeAction($ids) protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php index 5d81c1405efe0..659734b126048 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php @@ -69,7 +69,7 @@ public function __construct( IndexerRegistry $indexerRegistry = null ) { parent::__construct($resource, $storeManager, $config, $queryGenerator, $metadataPool); - $this->cacheContext = $cacheContext ?: ObjectManager::getInstance()->get(CacheContext::class); + $this->cacheContext = $cacheContext ?: ObjectManager::getInstance()->create(CacheContext::class); $this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(EventManagerInterface::class); $this->indexerRegistry = $indexerRegistry ?: ObjectManager::getInstance()->get(IndexerRegistry::class); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php index ec3d0d57330ec..ca5648ef51204 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php @@ -69,7 +69,7 @@ public function __construct( IndexerRegistry $indexerRegistry = null ) { parent::__construct($resource, $storeManager, $config, $queryGenerator, $metadataPool); - $this->cacheContext = $cacheContext ?: ObjectManager::getInstance()->get(CacheContext::class); + $this->cacheContext = $cacheContext ?: ObjectManager::getInstance()->create(CacheContext::class); $this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(EventManagerInterface::class); $this->indexerRegistry = $indexerRegistry ?: ObjectManager::getInstance()->get(IndexerRegistry::class); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php b/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php index 3580eb6fd2551..76f9a37ae16f3 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php @@ -103,7 +103,7 @@ public function executeRow($id) protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php index 148f2331d7eec..eda6b8e5c513b 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php @@ -103,7 +103,7 @@ public function executeRow($id) protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php index 4b35bfdc7ab1e..a599701bf981f 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php @@ -106,7 +106,7 @@ public function executeRow($id) protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php index 6b7c12dfdf463..15b06abfa1799 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php @@ -163,7 +163,7 @@ private function getCacheManager() protected function getCacheContext() { if (!($this->cacheContext instanceof CacheContext)) { - return \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class); + return \Magento\Framework\App\ObjectManager::getInstance()->create(CacheContext::class); } else { return $this->cacheContext; } diff --git a/app/etc/di.xml b/app/etc/di.xml index fed2e336046f9..4d8d9a4c31634 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -1840,4 +1840,5 @@ +