Skip to content

Commit

Permalink
retry msg send once on timeout error
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Nov 5, 2023
1 parent 18ce6fd commit f356857
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/vc/live/LiveFeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -190,6 +191,9 @@ private Mono<?> processSend(final Map.Entry<String, RestChannel> 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();
Expand Down

0 comments on commit f356857

Please sign in to comment.