Skip to content

Commit c6624cb

Browse files
committed
Stop $this-validColumnNames array from growing and growing as its value is recursively updated with its own data several times. Importing hundred of customers affect performance and even break due to memory limits
1 parent c6d14d1 commit c6624cb

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,11 @@ public function getEntityTable()
569569
*/
570570
public function getValidColumnNames()
571571
{
572-
$this->validColumnNames = array_merge(
573-
$this->validColumnNames,
574-
$this->customerFields
572+
return array_unique(
573+
array_merge(
574+
$this->validColumnNames,
575+
$this->customerFields
576+
)
575577
);
576-
577-
return $this->validColumnNames;
578578
}
579579
}

app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,13 @@ protected function _prepareRowForDb(array $rowData)
488488
*/
489489
public function getValidColumnNames()
490490
{
491-
$this->validColumnNames = array_merge(
492-
$this->validColumnNames,
493-
$this->_customerAttributes,
494-
$this->_addressAttributes,
495-
$this->_customerEntity->getValidColumnNames()
491+
return array_unique(
492+
array_merge(
493+
$this->validColumnNames,
494+
$this->_customerAttributes,
495+
$this->_addressAttributes,
496+
$this->_customerEntity->getValidColumnNames()
497+
)
496498
);
497-
498-
return $this->validColumnNames;
499499
}
500500
}

0 commit comments

Comments
 (0)