From f35685770adb6c804e210dd927bc7c84fa93f44b Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Sat, 4 Nov 2023 17:40:14 -0700 Subject: [PATCH] retry msg send once on timeout error --- src/main/java/vc/live/LiveFeed.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/vc/live/LiveFeed.java b/src/main/java/vc/live/LiveFeed.java index a48b0d0..51e3702 100644 --- a/src/main/java/vc/live/LiveFeed.java +++ b/src/main/java/vc/live/LiveFeed.java @@ -15,6 +15,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; +import reactor.util.retry.Retry; import vc.config.GuildConfigManager; import vc.config.GuildConfigRecord; @@ -190,6 +191,9 @@ private Mono processSend(final Map.Entry entry, final Li .embeds(embeds) .build()) .timeout(Duration.ofSeconds(3)) + // retry only on TimeoutException + .retryWhen(Retry.fixedDelay(1, Duration.ofSeconds(1)) + .filter(error -> error instanceof TimeoutException)) .onErrorResume(error -> { if (error instanceof ClientException e) { int code = e.getStatus().code();