Skip to content

Commit a0970cb

Browse files
committed
MAGETWO-80789: [Indexer] Search Indexer is scoped & multi-threaded
1 parent efc03a2 commit a0970cb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/code/Magento/CatalogSearch/Test/Unit/Model/Indexer/FulltextTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ class FulltextTest extends \PHPUnit\Framework\TestCase
5454
*/
5555
private $indexSwitcher;
5656

57+
/**
58+
* @var \Magento\Indexer\Model\ProcessManager
59+
*/
60+
private $processManager;
61+
5762
protected function setUp()
5863
{
5964
$this->fullAction = $this->getClassMock(\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full::class);
@@ -89,6 +94,8 @@ protected function setUp()
8994
->setMethods(['switchIndex'])
9095
->getMock();
9196

97+
$this->processManager = new \Magento\Indexer\Model\ProcessManager();
98+
9299
$objectManagerHelper = new ObjectManagerHelper($this);
93100
$this->model = $objectManagerHelper->getObject(
94101
\Magento\CatalogSearch\Model\Indexer\Fulltext::class,
@@ -101,6 +108,7 @@ protected function setUp()
101108
'searchRequestConfig' => $this->searchRequestConfig,
102109
'data' => [],
103110
'indexSwitcher' => $this->indexSwitcher,
111+
'processManager' => $this->processManager,
104112
]
105113
);
106114
}

lib/internal/Magento/Framework/App/ResourceConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ public function closeConnection($resourceName = self::DEFAULT_CONNECTION)
105105
{
106106
if ($resourceName === null) {
107107
foreach ($this->connections as $processConnection) {
108-
if ($processConnection instanceof AdapterInterface) {
108+
if ($processConnection !== null) {
109109
$processConnection->closeConnection();
110110
}
111111
}
112112
$this->connections = [];
113113
} else {
114114
$processConnectionName = $this->getProcessConnectionName($this->config->getConnectionName($resourceName));
115115
if (isset($this->connections[$processConnectionName])) {
116-
if ($this->connections[$processConnectionName] instanceof AdapterInterface) {
116+
if ($this->connections[$processConnectionName] !== null) {
117117
$this->connections[$processConnectionName]->closeConnection();
118118
}
119119
$this->connections[$processConnectionName] = null;

0 commit comments

Comments
 (0)