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

Desktop: Fixes #10740: Improve the reliability of fetching resources #10813

Closed

Conversation

pedr
Copy link
Collaborator

@pedr pedr commented Aug 2, 2024

Fixes: #10740

Summary

As reported by the user, the new code, when timeout is set to undefined, uses the http.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.

@pedr pedr added bug It's a bug desktop All desktop platforms labels Aug 2, 2024
@pedr pedr requested a review from laurent22 August 2, 2024 03:13
@pedr pedr changed the title Desktop: Fixes #10740: Increase the default timeout value for request to resources to 60 seconds Desktop: Fixes #10740: Improve the reliability of fetching resources Aug 2, 2024
@@ -630,6 +630,7 @@ function shimInit(options: ShimInitOptions = null) {
});

request.on('timeout', () => {
if (!requestOptions.timeout) return;
Copy link
Owner

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.

@personalizedrefrigerator
Copy link
Collaborator

laurent22:dev from pedr:remove-timeout-from-fetchBlob

Could it make sense to target release-3.0 instead of dev? (I think this is a regression from 2.14)

@pedr pedr changed the base branch from dev to release-3.0 August 5, 2024 13:58
@pedr pedr force-pushed the remove-timeout-from-fetchBlob branch from c7ab7c7 to 13c2463 Compare August 5, 2024 14:38
@pedr
Copy link
Collaborator Author

pedr commented Aug 5, 2024

Closing in favour of #10826 since it should be targeting 3.0

@pedr pedr closed this Aug 5, 2024
@pedr pedr deleted the remove-timeout-from-fetchBlob branch August 5, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Desktop time-out when synchronising large attachments from Joplin Server
5 participants