-
Notifications
You must be signed in to change notification settings - Fork 114
Description
Hey all 👋
I have an application running Rails 8.0.2 and had just added ActiveStorage to my application. In development, I noticed the uploaded images had very slow response times.
I started debugging the problem and noticed the issue has to do with the cache sweeper being executed even for requests to ActiveStorage::DiskController#show, which is responsible for responding with the uploaded file requested.
https://github.com/rails/propshaft/blob/main/lib/propshaft/railtie.rb#L59
That means the cache sweeper is executed multiple times depending on how many uploaded files are being requested on the page. In my case, I have over 2k (I know, I know) .svg icons in my assets folder and the default file watcher takes its time to check every single one of them. Updating the file watcher improves the response time quite a bit though.
The thing is, I can't see a reason why the cache sweeper should be executed when requesting an uploaded file from ActiveStorage. What do you all think about this?