From e18db3bdc8ad4c72aa4fa3a7e2b0481cfdbf0e95 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 4 Jun 2020 17:21:57 +0200 Subject: Do not query the participants for pushing call notifications We can skip the participant check when we generate push notifications. We just looped over the participants to create the notifications, they can not be removed between these 2 steps, so we can save all those queries. Signed-off-by: Joas Schilling --- lib/Notification/Notifier.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 092cf186b..9ff13f7a6 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -179,11 +179,18 @@ class Notifier implements INotifier { throw new AlreadyProcessedException(); } - try { - $participant = $room->getParticipant($userId); - } catch (ParticipantNotFoundException $e) { - // Room does not exist - throw new AlreadyProcessedException(); + if ($this->notificationManager->isPreparingPushNotification() && $notification->getSubject() === 'call') { + // Skip the participant check when we generate push notifications + // we just looped over the participants to create the notification, + // they can not be removed between these 2 steps, but we can save + // n queries. + } else { + try { + $participant = $room->getParticipant($userId); + } catch (ParticipantNotFoundException $e) { + // Room does not exist + throw new AlreadyProcessedException(); + } } $notification -- cgit v1.2.3