Add alternative to memory limit
This commit is contained in:
parent
172b473416
commit
9dcbbdaf69
|
@ -163,8 +163,8 @@ class CsvImportCommand extends Console
|
|||
$progressIndicator->advance();
|
||||
$progressIndicator->setMessage('Importing... ' . (string) $count . ' records done.');
|
||||
|
||||
// Flush to database if memory usage reaches limit.
|
||||
if ((memory_get_usage() / $phpMemoryLimit) > $memoryLimit) {
|
||||
// Flush to database if memory usage reaches limit or every 50.000 records.
|
||||
if ((memory_get_usage() / $phpMemoryLimit) > $memoryLimit || ($count % 50000) === 0) {
|
||||
Database::getInstance()->flush([Record::class]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue