Skip to content

Commit 15206e9

Browse files
authored
cf: retry file download on premature close error (#591)
Also * cf: switch to backoff delay
1 parent 868521f commit 15206e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/me/itzg/helpers/curseforge/CurseForgeInstaller.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import reactor.core.publisher.Flux;
6666
import reactor.core.publisher.Mono;
6767
import reactor.core.scheduler.Schedulers;
68+
import reactor.netty.http.client.PrematureCloseException;
6869
import reactor.util.retry.Retry;
6970

7071
@RequiredArgsConstructor
@@ -753,10 +754,11 @@ private Mono<DownloadOrResolveResult> buildRetryableDownload(InstallContext con
753754
)
754755
// retry the deferred part above if one of the expected failure cases
755756
.retryWhen(
756-
Retry.fixedDelay(BAD_FILE_ATTEMPTS, BAD_FILE_DELAY)
757+
Retry.backoff(BAD_FILE_ATTEMPTS, BAD_FILE_DELAY)
757758
.filter(throwable ->
758759
throwable instanceof FileHashInvalidException ||
759-
throwable instanceof FailedRequestException
760+
throwable instanceof FailedRequestException ||
761+
throwable instanceof PrematureCloseException
760762
)
761763
.doBeforeRetry(retrySignal ->
762764
log.warn("Retrying to download {} @ {}:{}",

0 commit comments

Comments
 (0)