From 4144b4dc740c83dc0131415ff91b5beb9263587b Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 8 Dec 2013 23:44:25 -0600 Subject: [PATCH] only send cache deletions for usable locales Right now we're spending too much time expiring cache keys when getting contributions. The longer-term fix is to move it to a background task, but it's good to restrict deletions only to usable locales rather than all the ones that Rails theoretically supports. --- app/models/fragment_expiration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/fragment_expiration.rb b/app/models/fragment_expiration.rb index 1f312829..8d14a8f6 100644 --- a/app/models/fragment_expiration.rb +++ b/app/models/fragment_expiration.rb @@ -4,14 +4,14 @@ module FragmentExpiration delegate :expire_fragment, :to => :controller def expire_fragment_in_all_locales(key) - I18n.available_locales.each do |locale| + I18n.usable_locales.each do |locale| localized_key = localize_fragment_key(key, locale) expire_fragment(localized_key) end end def expire_key_in_all_locales(key) - I18n.available_locales.each do |locale| + I18n.usable_locales.each do |locale| localized_key = localize_fragment_key(key, locale) Rails.cache.delete(localized_key) end