diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-04 18:21:57 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-04 18:21:57 +0300 |
commit | 03e3b4c71bb13fbe6f5a39bf5c713553c03bbec5 (patch) | |
tree | d35d09186df1ffb75c78956c498bd2c38cbe7805 /lib/Notification/Notifier.php | |
parent | 97777821886b364c23a2157d5de5f57e4be119a0 (diff) |
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 <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r-- | lib/Notification/Notifier.php | 17 |
1 files changed, 12 insertions, 5 deletions
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 |