From c32d8d62ddcef0705d19eb4b28595c0aa694d808 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Wed, 4 Oct 2023 15:51:49 +0330 Subject: [PATCH] Memoize the genrerated host hash --- lib/shakapacker/digest_strategy.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/shakapacker/digest_strategy.rb b/lib/shakapacker/digest_strategy.rb index b0770feb7..146627516 100644 --- a/lib/shakapacker/digest_strategy.rb +++ b/lib/shakapacker/digest_strategy.rb @@ -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