-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-source-filesystem): Retry stalled remote file downloads #20843
Conversation
df34bb6
to
d673e9a
Compare
837654d
to
5304fc9
Compare
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.
Thank you! 🥇
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.
Left a small comment!
packages/gatsby-source-filesystem/src/create-remote-file-node.js
Outdated
Show resolved
Hide resolved
56d11bd
to
f02a80c
Compare
…atsbyjs#20843) * fix(gatsby-source-filesystem): Retry stalled remote file downloads * Switch to got@8 * Await the recursive callback * Add tests for loading fix * Don't reset on data. Start timout after `response` * Add got timeout * Don't await the recursive call * Use constants for connection timeouts
}) | ||
const fsWriteStream = fs.createWriteStream(tmpFilename) | ||
responseStream.pipe(fsWriteStream) | ||
responseStream.on(`downloadProgress`, pro => console.log(pro)) |
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.
the console.log
is removed accidentally in resetTimeout
?
I think this is breaking my build (at least locally with Don't have time to grok the code, but what I think is happening: I'm using Ultimately, what I'm sure of is that increasing the timeout to 20 min fixes my issues. |
…atsbyjs#20843) * fix(gatsby-source-filesystem): Retry stalled remote file downloads * Switch to got@8 * Await the recursive callback * Add tests for loading fix * Don't reset on data. Start timout after `response` * Add got timeout * Don't await the recursive call * Use constants for connection timeouts
Description
gatsby-source-filesystem has a problem where downloads would stall and never timeout or error. Eventually all the concurrent downloads were stalled, preventing any more starting. This was causing builds to stall indefinitely.
This PR adds a timeout in
createRemoteFileNode
. If nodata
events are received in the download stream for 30 seconds then the download is cancelled and retried up to three times. In tests this unblocks the downloads on the first attempt.WIP while I'm writing unit tests.
Documentation
Related Issues