Save scratch assets to bucket#827
Draft
zetter-rpf wants to merge 4 commits into
Draft
Conversation
Test coverage91.33% line coverage reported by SimpleCov. |
My next commit will add in another task to the import, having one instance of ScratchAssetImporter per asset, will make easier to cache the asset and not download it twice
f59f5d8 to
4108979
Compare
Many assets from the asset library are rendered on the page at once which will cause a lot of requests to editor API. This is being stored in the editor-assets r2 bucket. Note that region isn't used by has to be set to a valid value.
4108979 to
ea17a52
Compare
Since these are keyed by their md5 hash we can cache them for a long time (I've chosen 7 days). R2 does add an etag, but the adding this will mean etags won't need to be checked and might enable cloudflare to do more caching.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
To do:
What's changed?
This syncs Scratch asset library assets into a bucket so we can serve them over a CDN.
I intend to use the same bucket across all the environments- as objects are keyed by their MD5 hash I think this is safe to do. When updating we should run it in production.
Steps to perform before deploying to production