This repository has been archived by the owner on Apr 29, 2019. It is now read-only.
ImportExport: Running multiple data imports in a single script can cause errors #39
Labels
Milestone
From @koenner01 on November 3, 2017 9:34
When running multiple data imports in a single script (we are first running a category import, then several product imports), problems can occur.
We are using a script that uses a \Magento\ImportExport\Model\ImportFactory to create \Magento\ImportExport\Model\Import objects for each individual import. But because the Import model object is using a singleton implementation of \Magento\ImportExport\Model\ResourceModel\Import\Data, the data is shared between different imports. This causes problems for the second import because the previous data isn't cleared.
Preconditions
Steps to reproduce
example (pseudo code-ish)
Expected result
Actual result
Notes:
We have found a fix for our situation by doing:
By adding the getNextBunch function, the iterator on the data is being reset between each import. This is far from ideal but it works.
The best fix would be to add a \Magento\ImportExport\Model\ResourceModel\Import\DataFactory implementation to \Magento\ImportExport\Model\Import instead of using the singleton approach but this requires an overhaul on the core files..
This issue is also not always reproducible, which will probably be the reason why this issue will be closed; But hopefully someone who stumbles on the same problem as us finds any use in our fix.
Copied from original issue: magento/magento2#11990
The text was updated successfully, but these errors were encountered: