-
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
feat(gatsby-core-utils): Add retry on HTTP status codes to fetchRemoteFile
#33461
Conversation
@wardpeet as you suggested, I moved the logic from my wrapper into the error handler of the stream. I struggle to add an actual timeout to the retry. Also I am still not sure how and if we should simulate generic network errors, but for sure we should try to retry them. |
\\"responseStatusCode\\": 503, | ||
\\"responseStatusMessage\\": \\"Service Unavailable\\", | ||
\\"requestHeaders\\": { | ||
\\"user-agent\\": \\"got (https://github.com/sindresorhus/got)\\", |
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.
Out of scope for this.. but... what if we send a user-agent that contains GatsbyJS and the current version? Could imagine that would increase the visibility in logs, and might even help in support tickets.
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.
Nice!
fetchRemoteFile
This is sadly blocking us from being able to upgrade to Gatsby v4 as our build fails trying to download images from Contentful. Happens randomly but consistently after downloading 250+ images for us in the dev environment. Edit: A fun read about unexplained connection resets in Docker - https://tech.xing.com/a-reason-for-unexplained-connection-timeouts-on-kubernetes-docker-abd041cf7e02 |
@njbmartin thank you for the link. This is currently our highest priority, I want to fix this in 2021! |
The old version of gatsby-source-contentful was reducing this issues by limiting the parallel downloads to 100 at the same time. It was not perfect, but drastically reduced the number of required retries. |
0922e59
to
ea39580
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.
Awesome! This fixes so many things! 🎉
Ohh yeah! :) |
|
…teFile` (gatsbyjs#33461) * feat: add retry to fetch remote file * refactor to retry withing stream error event handler * review changes * fix tests * add test and retry for network errors * remove retry logger Co-authored-by: Ward Peeters <ward@coding-tech.com>
We currently do not retry on certain status codes and network errors. This can cause issues when building projects that use a lot of remote assets that need to be fetched.
This replaces #30391.
Status:
fetchRemoteFile