fix(tasks): pre-generate thumbnails for active_storage#4037
Draft
tvdeyen wants to merge 1 commit into
Draft
Conversation
eb81251 to
516b415
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4037 +/- ##
=======================================
Coverage 97.99% 98.00%
=======================================
Files 346 347 +1
Lines 8995 9027 +32
=======================================
+ Hits 8815 8847 +32
Misses 180 180 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
516b415 to
0ff3cfc
Compare
The alchemy:generate:thumbnails task was written for Dragonfly: it called PictureThumb.generate_thumbs! directly and warmed ingredient variants by requesting their urls, both of which only persist a thumbnail as a Dragonfly side effect. Under the now-default active_storage adapter it generated nothing and its :thumbs preload referenced an association that does not exist there. Move the logic into an Alchemy::GenerateThumbnails service that branches on the configured storage adapter and materializes each variant inline, so existing pictures and their ingredient crop and srcset variants are warmed on both adapters. The service yields each processed record so the rake task can report progress during a long running generation run.
0ff3cfc to
1bf2c67
Compare
Member
Author
|
Let's use ActiveJob and add a async argument to the rake task, so if needed we can background the thumbnail generation |
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.
What is this pull request for?
The
alchemy:generate:thumbnailstask was written for Dragonfly: it calledPictureThumb.generate_thumbs!directly and warmed ingredient variants by requesting their urls, both of which only persist a thumbnail as a Dragonfly side effect.Under the now-default active_storage adapter it generated nothing and its :thumbs preload referenced an association that does not exist there. Move the logic into an
Alchemy::GenerateThumbnailsservice that branches on the configured storage adapter and materializes each variant inline, so existing pictures and their ingredient crop and srcset variants are warmed on both adapters.Checklist