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