Skip to content

Commit

Permalink
Set CLI message when flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer committed Feb 1, 2024
1 parent 9dcbbda commit 98c8325
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Console/CsvImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int

++$count;
$progressIndicator->advance();
$progressIndicator->setMessage('Importing... ' . (string) $count . ' records done.');
$progressIndicator->setMessage('Importing... ' . (string) $count . ' records processed.');

// Flush to database if memory usage reaches limit or every 50.000 records.
if ((memory_get_usage() / $phpMemoryLimit) > $memoryLimit || ($count % 50000) === 0) {
$progressIndicator->setMessage('Importing... ' . (string) $count . ' records processed. Flushing to database...');
Database::getInstance()->flush([Record::class]);
}
}
Expand Down

0 comments on commit 98c8325

Please sign in to comment.