mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 06:48:04 +01:00
Pause if we hit an exception while processing scheduled notifications
This commit is contained in:
committed by
Jon Chambers
parent
dbbd913445
commit
1cc933b6bc
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user