Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read response body timeout #169

Merged
merged 2 commits into from
Aug 9, 2024
Merged

Read response body timeout #169

merged 2 commits into from
Aug 9, 2024

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
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.

Copy link

sonarqubecloud bot commented Aug 9, 2024

@w3stling w3stling merged commit 67f9f21 into master Aug 9, 2024
5 checks passed
@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