Skip to content

Read response body timeout#169

Merged
w3stling merged 2 commits intomasterfrom
add-read-timeout
Aug 9, 2024
Merged

Read response body timeout#169
w3stling merged 2 commits intomasterfrom
add-read-timeout

Conversation

@w3stling
Copy link
Owner

@w3stling w3stling commented Aug 9, 2024

This PR adds a timeout for reading the response body. The default value for read timeout is 25 seconds. To disable read timeout set value to Duration.ZERO. This can be useful if an HTTP client that supports read timeout is used and an InputStream is passed to RssReader.

Exposing methods for setting connection timeout and request timeout. The default value for these timeouts is 25 seconds, the same as in previous releases.

Example for changing timeout:

var timeout = Duration.ofSeconds(10);

var items = new RssReader()
        .setConnectionTimeout(timeout)
        .setRequestTimeout(timeout)
        .setReadTimeout(timeout)
        .read("https://lwn.net/headlines/rss")
        .collect(Collectors.toList());

This PR fixes issue #163

@w3stling w3stling added the enhancement New feature or request label Aug 9, 2024
@github-actions
Copy link

github-actions bot commented Aug 9, 2024

Test Results

  9 files    9 suites   35s ⏱️
149 tests 147 ✅ 2 💤 0 ❌
157 runs  155 ✅ 2 💤 0 ❌

Results for commit 764c431.

♻️ This comment has been updated with latest results.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 9, 2024

@w3stling w3stling merged commit 67f9f21 into master Aug 9, 2024
@w3stling w3stling changed the title Add read timeout Read response body timeout Aug 9, 2024
@w3stling w3stling deleted the add-read-timeout branch August 11, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant