Skip to content

Commit

Permalink
fixup! fix(notifications): Preparse call notifications for improved p…
Browse files Browse the repository at this point in the history
…erformance
  • Loading branch information
nickvergessen committed Apr 30, 2024
1 parent d7fd9a9 commit 847c7ec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Notification/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,23 @@ protected function sendCallNotifications(Room $room): void {
$this->notificationManager->setPreparingPushNotification(true);
$this->preparedCallNotifications[$languageCode] = $this->notificationProvider->prepare($translatedNotification, $languageCode);
$this->notificationManager->setPreparingPushNotification(false);
$notification = $translatedNotification;
$userNotification = $translatedNotification;
if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #7.2.' . $languageCode . ': ' . microtime(true));
}
} else {
$notification = $this->preparedCallNotifications[$languageCode];
$userNotification = $this->preparedCallNotifications[$languageCode];
if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #7.2.reused.' . $languageCode . ': ' . microtime(true));
}
}
} else {
$userNotification = $notification;
}

try {
$notification->setUser($userId);
$this->notificationManager->notify($notification);
$userNotification->setUser($userId);
$this->notificationManager->notify($userNotification);
} catch (\InvalidArgumentException $e) {
$this->logger->error($e->getMessage(), ['exception' => $e]);
}
Expand Down

0 comments on commit 847c7ec

Please sign in to comment.