From 744b05244dd476ecce7d095a68c91920639421bc Mon Sep 17 00:00:00 2001 From: Chris Eager Date: Tue, 25 Mar 2025 11:08:13 -0500 Subject: [PATCH] Add onErrorResume and retries to eligibility check in NotifyIdleDevicesCommand --- .../workers/NotifyIdleDevicesCommand.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/NotifyIdleDevicesCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/NotifyIdleDevicesCommand.java index 394b796d5..72ef89c76 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/NotifyIdleDevicesCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/NotifyIdleDevicesCommand.java @@ -16,7 +16,9 @@ import org.whispersystems.textsecuregcm.storage.MessagesManager; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.util.function.Tuples; +import reactor.util.retry.Retry; import java.time.Clock; +import java.time.Duration; import java.time.LocalTime; public class NotifyIdleDevicesCommand extends AbstractSinglePassCrawlAccountsCommand { @@ -79,7 +81,16 @@ public class NotifyIdleDevicesCommand extends AbstractSinglePassCrawlAccountsCom .doOnNext(ignored -> DEVICE_INSPECTED_COUNTER.increment()) .flatMap(accountAndDevice -> Mono.fromFuture(() -> idleWakeupEligibilityChecker.isDeviceEligible(accountAndDevice.getT1(), accountAndDevice.getT2())) - .mapNotNull(eligible -> eligible ? accountAndDevice : null), + .mapNotNull(eligible -> eligible ? accountAndDevice : null) + .retryWhen(Retry.backoff(3, Duration.ofSeconds(1))) + .onErrorResume(throwable -> { + log.warn("Failed to check eligibility for {}:{}", + accountAndDevice.getT1().getIdentifier(IdentityType.ACI), + accountAndDevice.getT2().getId(), + throwable); + + return Mono.empty(); + }), maxConcurrency) .flatMap(accountAndDevice -> { final Account account = accountAndDevice.getT1();