Skip to content

Commit

Permalink
add buffering to roles
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStorz committed May 27, 2024
1 parent 9800583 commit 5dd2323
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Command/ImportFromJsonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ private function importRoleTypes(OutputInterface $output)
$role->setItLabel($roleType['label_it']);

$this->em->persist($role);
$this->em->flush();
if (0 === ($i % $this->batchSize)) {
$this->em->flush();
}
$i++;
}
$this->em->flush();
$timeElapsed = microtime(true) - $start;
$this->stats[] = ['role_types.json', $timeElapsed, $i];
$output->writeln([sprintf('%s rows imported from roles_types.json', $i)]);
Expand Down

0 comments on commit 5dd2323

Please sign in to comment.