Skip to content

Commit e39d438

Browse files
authored
fix: exception occurs when the file size bytes cannot be retrieved (#55)
1 parent 4018612 commit e39d438

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/src/main/java/run/halo/feed/RssXmlBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.common.base.Throwables;
44
import java.io.StringReader;
55
import java.nio.charset.StandardCharsets;
6+
import java.time.Duration;
67
import java.time.Instant;
78
import java.time.ZoneOffset;
89
import java.time.format.DateTimeFormatter;
@@ -33,6 +34,7 @@ public class RssXmlBuilder {
3334
+ "Chrome/131.0.0.0 Safari/537.36";
3435
private final WebClient webClient = WebClient.builder()
3536
.clientConnector(new ReactorClientHttpConnector(HttpClient.create()
37+
.responseTimeout(Duration.ofSeconds(1))
3638
.followRedirect(true))
3739
)
3840
.build();
@@ -313,6 +315,6 @@ private Long getFileSizeBytes(String url) {
313315
)
314316
.onErrorReturn(0L)
315317
.blockOptional()
316-
.orElseThrow();
318+
.orElse(0L);
317319
}
318320
}

0 commit comments

Comments
 (0)