Skip to content

Commit

Permalink
Memoize the genrerated host hash
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha committed Oct 4, 2023
1 parent cb84653 commit c32d8d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/shakapacker/digest_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ def compilation_digest_path
end

def generate_host_hash(*keys)
@generated_host_hashes ||= {}

keys = [Rails.application.config.asset_host, ENV["SHAKAPACKER_ASSET_HOST"]] if keys.empty?
Digest::SHA1.hexdigest(keys.join("-"))

@generated_host_hashes[keys] = Digest::SHA1.hexdigest(keys.join("-"))
end
end
end

0 comments on commit c32d8d6

Please sign in to comment.