Remove configuration option for memory limit
This commit is contained in:
parent
c4de671caa
commit
0674cf58bf
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -121,7 +121,6 @@ class CsvImportCommand extends Console
|
|||
return Command::INVALID;
|
||||
}
|
||||
$phpMemoryLimit = $this->getPhpMemoryLimit();
|
||||
$memoryLimit = Configuration::getInstance()->memoryLimit;
|
||||
|
||||
/** @var array<string, string> */
|
||||
$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]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue