Skip to content

Commit e489eaa

Browse files
committed
MC-31089: [Escalation] [SAQ] - Customer migration is too slow
1 parent c2d6426 commit e489eaa

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Address/Storage.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,7 @@ public function prepareAddresses(array $forCustomersIds): void
142142
}
143143

144144
$forCustomersIds = array_unique($forCustomersIds);
145-
$customerIdsToUse = [];
146-
foreach ($forCustomersIds as $customerId) {
147-
if (!array_key_exists($customerId, $this->addresses)) {
148-
$customerIdsToUse[] = (int) $customerId;
149-
}
150-
}
151-
145+
$customerIdsToUse = array_diff($forCustomersIds, array_keys($this->addresses));
152146
$this->loadAddresses($customerIdsToUse);
153147
}
154148
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ public function getCustomerId(string $email, int $websiteId)
179179
return false;
180180
}
181181

182+
/**
183+
* Get previously loaded customer id.
184+
*
185+
* @param string $email
186+
* @param int $websiteId
187+
* @return int|null
188+
*/
189+
public function getLoadedCustomerId(string $email, int $websiteId): ?int
190+
{
191+
return $this->_customerIds[mb_strtolower($email)][$websiteId] ?? null;
192+
}
193+
182194
/**
183195
* Find customer store ID for unique pair of email and website ID.
184196
*

0 commit comments

Comments
 (0)