Skip to content

Commit

Permalink
Reduce flushing (performance)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 19, 2023
1 parent 16ba3ac commit bcf39ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/src/Controller/BackOfficeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ public function backOfficeReset(string $serverID) : JsonResponse
->findBy(['serverid' => $serverID]);
foreach ($entities as $entity) {
$entityManager->remove($entity);
$entityManager->flush();
}
}
$entityManager->flush();

return new JsonResponse((object) ['reset' => true]);
}
Expand Down
3 changes: 1 addition & 2 deletions application/src/Controller/SynapseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,15 @@ public function deleteRoom(string $serverID, string $roomID, Request $request):
->findBy(['serverid' => $serverID, 'roomid' => $roomID]);
foreach ($roommembers as $entity) {
$entityManager->remove($entity);
$entityManager->flush();
}

$room = $this->getDoctrine()
->getRepository(Rooms::class)
->findBy(['roomid' => $roomID]);
if (!empty($room)) {
$entityManager->remove($room[0]);
$entityManager->flush();
}
$entityManager->flush();

return new JsonResponse((object) [
'delete_id' => substr(hash('sha256', (date("Ymdhms"))), 0, 18)
Expand Down

0 comments on commit bcf39ea

Please sign in to comment.