When uploading media through Media Library, core moves the file from temporary:// to public:// and calls image_path_flush().
This triggers all implementations of hook_image_style_flush().
The function image_effects_image_style_flush() performs an entityQuery across all image styles for every flushed style.
Moreover, this happens for every uploaded file.
Example: with 10 uploaded files and 100 image styles, the same query will be executed 1000 times.
On sites with hundreds or thousands of styles, this becomes extremely expensive and results in long delays (20+ seconds) and eventually 500 AJAX errors/timeouts when uploading multiple files.
Expected behavior
On file uploads (per-file flush), flushing should be fast and should not scan all image style configs.
On image style configuration changes (create, update, delete), cascading flush of dependent styles is indeed required, but it should be implemented efficiently (e.g. via cached reverse dependency map instead of repeated full entityQueries).
Issue fork image_effects-3550003
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
david-b commentedComment #8
mondrakeThank you, can you please target branch 5.0.x - we will likely not have a 4.1.0 release for the same reason of #3549711: Stable release imagemagick 4.1.0.
We can backport to 4.0.x once committed to the next major.