From 1cc933b6bc9c84eceddeb94506fe5ad587eb099d Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Fri, 22 Aug 2025 17:02:54 -0400 Subject: [PATCH] Pause if we hit an exception while processing scheduled notifications --- .../textsecuregcm/push/PushNotificationScheduler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationScheduler.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationScheduler.java index b9039a854..1230217e1 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationScheduler.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationScheduler.java @@ -51,6 +51,8 @@ public class PushNotificationScheduler implements Managed { @VisibleForTesting static final String NEXT_SLOT_TO_PROCESS_KEY = "pending_notification_next_slot"; + private static final Duration EXCEPTION_PAUSE = Duration.ofSeconds(3); + private static final String BACKGROUND_NOTIFICATION_SCHEDULED_COUNTER_NAME = name(PushNotificationScheduler.class, "backgroundNotification", "scheduled"); private static final String BACKGROUND_NOTIFICATION_SENT_COUNTER_NAME = name(PushNotificationScheduler.class, "backgroundNotification", "sent"); @@ -92,7 +94,12 @@ public class PushNotificationScheduler implements Managed { Util.sleep(1000); } } catch (Exception e) { - logger.warn("Exception while operating", e); + logger.warn("Exception while processing scheduled notifications", e); + + try { + Thread.sleep(EXCEPTION_PAUSE); + } catch (final InterruptedException _) { + } } } while (running.get()); }