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

Enhancement: response timeout to be configurable from environment #123

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

Matte22
Copy link
Collaborator

@Matte22 Matte22 commented Jun 7, 2024

Resolves: #120
This PR enhances our API request timeout to be configurable. It Also increases the default request timeout to 20 seconds.

@csmig
Copy link
Member

csmig commented Jun 10, 2024

The PR should be updated to change the option name to responseTimeout and set the corresponding timeout property in the request options. Discussion below:

The got library supports timeouts for various events during a request/response.

We set a timeout primarily to detect an apiOffline condition. We've been setting the request timeout which starts when the request is initiated and ends when the response's end event fires. The response's end event fires when the entire response body has been received. For large bodies sent across slow networks this may trigger false positives of the offline condition.

We should instead set the response timeout which starts when the request has been fully sent and ends when the HTTP headers are received, which happens prior to receiving the response body. This will more accurately reflect the API's online status with less chance of a false positive.

@csmig csmig changed the title Enhancement: request timeout to be configurable from environment Enhancement: response timeout to be configurable from environment Jun 10, 2024
Copy link

Quality Gate Passed Quality Gate passed for 'NUWCDIVNPT_stigman-watcher'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@csmig csmig merged commit ed5f8c3 into main Jun 10, 2024
3 checks passed
@csmig csmig deleted the request-timeout branch June 10, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make REQUEST_TIMEOUT user configurable
2 participants