-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Desktop: Fixes #10740: Improve the reliability of fetching resources #10813
Conversation
packages/lib/shim-init-node.ts
Outdated
@@ -630,6 +630,7 @@ function shimInit(options: ShimInitOptions = null) { | |||
}); | |||
|
|||
request.on('timeout', () => { | |||
if (!requestOptions.timeout) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here please? I know we cannot test this, but some information on why we do that could help future developers.
Could it make sense to target |
Auto-updated using release-website.sh
…th other parts of the app (laurent22#10636)
c7ab7c7
to
13c2463
Compare
Closing in favour of #10826 since it should be targeting 3.0 |
Fixes: #10740
Summary
As reported by the user, the new code, when
timeout
is set to undefined, uses thehttp.globalAgent
which has a default timeout to 5 seconds.Previously, this wouldn't be a problem because we didn't have an event handler for
timeout
event, so now I'm checking if the timeout was specified for this request, and if it wasn't I opt to not destroy the request.I also added more information to the log message when the request timeout.
Testing
To test this change I created a simple HTTP server, with a sleep function in the endpoint that returns one of the images from a static HTML page.
After that, I used the Web Clipper to save the full HTML page, which will use the
fetchBlob
function to download the image.The sleep function should be higher than the timeout value, if that happens we can see the
timeout
event being generated.