From be241ed8e284281eb6420adb419a7a030c23d297 Mon Sep 17 00:00:00 2001 From: Jym Dyer Date: Mon, 28 Aug 2023 10:58:31 -0700 Subject: [PATCH] Actually, put it very near the very top, after getting `otpUser`. --- .../tripmonitor/jobs/CheckMonitoredTrip.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/opentripplanner/middleware/tripmonitor/jobs/CheckMonitoredTrip.java b/src/main/java/org/opentripplanner/middleware/tripmonitor/jobs/CheckMonitoredTrip.java index d591f4fc0..5c3f15f68 100644 --- a/src/main/java/org/opentripplanner/middleware/tripmonitor/jobs/CheckMonitoredTrip.java +++ b/src/main/java/org/opentripplanner/middleware/tripmonitor/jobs/CheckMonitoredTrip.java @@ -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); @@ -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)) {