Skip to content

Commit

Permalink
Server should also sweep cache (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
brenogazzola authored Feb 5, 2025
1 parent 6a84a8c commit 689e756
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/propshaft/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def initialize(assembly)
end

def call(env)
execute_cache_sweeper_if_updated
path, digest = extract_path_and_digest(env)

if (asset = @assembly.load_path.find(path)) && asset.fresh?(digest)
Expand Down Expand Up @@ -44,4 +45,8 @@ def extract_path_and_digest(env)
else
VARY = "vary"
end

def execute_cache_sweeper_if_updated
Rails.application.assets.load_path.cache_sweeper.execute_if_updated
end
end

0 comments on commit 689e756

Please sign in to comment.