Skip to content

Conversation

gaffneyc
Copy link
Contributor

When trying to update to 1.2.0 we started getting consist errors in certain system tests that there were pending connections. I ran a bisect on propshaft and tracked it down to a change in 689e756 which looks like it may sweep the cache on every request for an asset (introduced in #232). Commenting out the line solved our immediate issue and got our test suite back to green.

Digging into this further it looks like cache sweeping would previously only occur when ActionController::Base was loaded and config.assets.sweep_cache was true (see here). By default sweep_cache is only set to true in development. But cache sweeping was also being run consistently in our test environment. This appeared to manifest as assets consistently being regenerated which effectively doubled the runtime of our system tests and would cause some pages to take too long to fully render which failed the tests.

This pull request adds the same check to the server that config.assets.sweep_cache is enabled which was happening in the railtie. I am not sure if this change is compatible with using propshaft without Rails as I don't know if the config is available in that context.

Lastly, without this check there is a risk that cache sweeping is occurring in production.

This mirrors code in the railtie that effectively enables cache sweeping
only in development unless otherwise configured.
@rafaelfranca rafaelfranca merged commit 4af2f12 into rails:main Jul 17, 2025
15 checks passed
@wlipa
Copy link
Contributor

wlipa commented Jul 20, 2025

1.2.1 is tagged on Github but has not made it to rubygems.org after a couple days. Problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants