-
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(contentful): add retry logic to asset downloading #29268
Conversation
Nvm, we already using axios |
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.
Added some comments. I'm curious if it would be possible to have base64 part of contentful sdk? This way we can get the base64 strings in sourceNodes and properly cache things.
Does axios-retry also take care of incomplete downloads? We've seen in source-filesystem that status ok is given but the file did not download all bytes
No, this is out of scope of our SDK. Ours SDK purpose is to simplify communication with our API, creating base64 variants is not a feature of our API therefore should not be part of the SDK, |
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.
Let's see if tests pass. Code looks good! Thank you!
|
||
let RetryAxios | ||
|
||
function getAxios(reporter) { |
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.
This slipped past review, reporter
never gets passed in from anywhere, so the retry logic never actually works. Test worked due to reporter
being stubbed. See #31590
@njbmartin yes, you are right :(
|
@njbmartin Thanks again, opened a PR to fix this in the next version: #31608 |
Contentful users with a huge number of assets might run into issues when requesting to many low quality image previews.
This adds a concurrency of 100 to the download process and a retry logic based on https://github.com/JustinBeckwith/retry-axios.
The very same logic will be applied when detecting the dominant color and creating a traced svg variant, for both gatsby-image and gatsby-plugin-image