Skip to content

Commit

Permalink
Actually, put it very near the very top, after getting otpUser.
Browse files Browse the repository at this point in the history
  • Loading branch information
JymDyerIBI committed Aug 28, 2023
1 parent fb0df00 commit be241ed
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,6 @@ public TripMonitorNotification checkTripForDelay(NotificationType delayType) {
* preferences.
*/
private void sendNotifications() {
if (notifications.size() == 0) {
// FIXME: Change log level
LOG.info("No notifications queued for trip. Skipping notify.");
return;
}
OtpUser otpUser = Persistence.otpUsers.getById(trip.userId);
if (otpUser == null) {
LOG.error("Cannot find user for id {}", trip.userId);
Expand All @@ -395,6 +390,11 @@ private void sendNotifications() {
otpUser.pushDevices = numPushDevices;
Persistence.otpUsers.replace(otpUser.id, otpUser);
}
if (notifications.size() == 0) {
// FIXME: Change log level
LOG.info("No notifications queued for trip. Skipping notify.");
return;
}
// If the same notifications were just sent, there is no need to send the same notification.
// TODO: Should there be some time threshold check here based on lastNotificationTime?
if (previousJourneyState.lastNotifications.containsAll(notifications)) {
Expand Down

0 comments on commit be241ed

Please sign in to comment.