NUWCDIVNPT / stigman-watcher

A utility that watches a path for test result files on behalf of a STIG Manager Collection
Other
6 stars 4 forks source link

Enhancement: response timeout to be configurable from environment #123

Closed Matte22 closed 4 months ago

Matte22 commented 4 months ago

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

csmig commented 4 months ago

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.

sonarcloud[bot] commented 4 months ago

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