-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Timeouts are longer than expected #2332
Comments
Hi @guillenotfound, it seems you're observing such a behavior because of retry mechanism, which, by default, retries requests that timed out up to 5 times (please check retry documentation). That's why total execution time is longer than you're expecting. At the same time, timings in error, in my understanding, reflects the timings for the latest request (last retry). Please try running your example with the following config: await got('https://httpbin.org/delay/10', {
timeout: { request: 1000 },
retry: { limit: 0 }
}); You'll see that the execution time is pretty close to 1 sec. |
Describe the bug
Actual behavior
The request is taking longer to respond but the timings in the error object look correct:
When executing the sample code, execution is taking above 6 seconds even if the timeout is 1.
Expected behavior
The request should last ~1000ms, it can be a few milliseconds more due to processing time, let's say max 1010ms.
Code to reproduce
I also have this in my tsconfig.json:
I've also tested this scenario with a brand new project and latest Got and I'm able to reproduce.
Checklist
The text was updated successfully, but these errors were encountered: