diff --git a/config/config.dist.yml b/config/config.dist.yml index d0922bf..0017c78 100644 --- a/config/config.dist.yml +++ b/config/config.dist.yml @@ -48,20 +48,6 @@ adminEmail: 'admin@example.org' # database: 'sqlite3:///%BASEDIR%/data/sqlite3.db' -# -# Memory Limit -# -# This defines the maximum amount of memory the indexing process should use per -# run before it persists changes to the database, flushes it's internal storage -# and starts over with the next batch of records. Higher settings result in -# better performance, but depending on the size of your records even smaller -# values may be needed to prevent running out of memory. -# The value is interpreted as a percentage of the PHP "memory_limit". -# -# [0.2 - 0.8] -# -memoryLimit: 0.5 - # # Metadata formats, namespaces and schemas of your records # diff --git a/src/Configuration.php b/src/Configuration.php index b70c686..c0f1e52 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -39,7 +39,6 @@ use Symfony\Component\Yaml\Yaml; * @property-read string $repositoryName * @property-read string $adminEmail * @property-read string $database - * @property-read float $memoryLimit * @property-read array $metadataPrefix * @property-read string $deletedRecords * @property-read int $maxRecords @@ -87,13 +86,6 @@ class Configuration new Assert\Type('string'), new Assert\NotBlank() ], - 'memoryLimit' => [ - new Assert\Type('float'), - new Assert\Range([ - 'min' => 0.2, - 'max' => 0.8 - ]) - ], 'metadataPrefix' => [ new Assert\Type('array'), new Assert\All([ diff --git a/src/Console/CsvImportCommand.php b/src/Console/CsvImportCommand.php index 888d4c4..dfeb24e 100644 --- a/src/Console/CsvImportCommand.php +++ b/src/Console/CsvImportCommand.php @@ -121,7 +121,6 @@ class CsvImportCommand extends Console return Command::INVALID; } $phpMemoryLimit = $this->getPhpMemoryLimit(); - $memoryLimit = Configuration::getInstance()->memoryLimit; /** @var array */ $arguments = $input->getArguments(); @@ -163,8 +162,8 @@ class CsvImportCommand extends Console $progressIndicator->advance(); $progressIndicator->setMessage('Importing... ' . (string) $count . ' records processed.'); - // Flush to database if memory usage reaches limit or every 10.000 records. - if ((memory_get_usage() / $phpMemoryLimit) > $memoryLimit || ($count % 10000) === 0) { + // Flush to database if memory usage reaches 50% or every 10.000 records. + if ((memory_get_usage() / $phpMemoryLimit) > 0.5 || ($count % 10000) === 0) { $progressIndicator->setMessage('Importing... ' . (string) $count . ' records processed. Flushing to database...'); Database::getInstance()->flush([Record::class]); }