From 98c8325db3e2532c576d6a444c0424de648aa6d4 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Thu, 1 Feb 2024 15:58:48 +0100 Subject: [PATCH] Set CLI message when flushing --- src/Console/CsvImportCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Console/CsvImportCommand.php b/src/Console/CsvImportCommand.php index 3ce8a95..53d054e 100644 --- a/src/Console/CsvImportCommand.php +++ b/src/Console/CsvImportCommand.php @@ -161,10 +161,11 @@ class CsvImportCommand extends Console ++$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]); } }