From 080569b3fd00651930ab3811ae9e95cc98b6cacc Mon Sep 17 00:00:00 2001 From: Jeremy Kescher Date: Fri, 17 Mar 2023 07:53:35 +0100 Subject: [PATCH] Remove fetch_value issue logging Since we've moved back to Ruby 3.1.3 in 9aa172f7df3dd1a8ba13711e8d7e2c1be1be008d and the issue only occurs on Ruby 3.2.1 due to the marshaller changing the ordering of instance variables, as explained by byroot / casperisfine in https://github.com/mastodon/mastodon/issues/23644#issuecomment-1472637530. As such, we no longer need this logging, and should be able to upgrade past Ruby 3.1 once the marshaller does ordering correctly again or Rails is changed to do custom marshalling. --- app/controllers/concerns/cache_concern.rb | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/app/controllers/concerns/cache_concern.rb b/app/controllers/concerns/cache_concern.rb index a010fac165..05e431b19a 100644 --- a/app/controllers/concerns/cache_concern.rb +++ b/app/controllers/concerns/cache_concern.rb @@ -34,25 +34,7 @@ module CacheConcern raw = raw.cache_ids.to_a if raw.is_a?(ActiveRecord::Relation) return [] if raw.empty? - cached_keys_with_value = begin - Rails.cache.read_multi(*raw).transform_keys(&:id) - rescue NoMethodError - culprit = raw.find do |item| - Rails.cache.read(item) - false - rescue NoMethodError - true - end - - Rails.logger.warn "culprit: #{culprit.inspect}" - - cache_key = Rails.cache.send(:normalize_key, culprit, {}) - entry = Rails.cache.send(:read_entry, cache_key) - raw_marshal = Zlib::Inflate.inflate(entry.instance_variable_get(:@value)) - Rails.logger.warn "base64 marshal: #{Base64.encode64(raw_marshal)}" - raise - end - + cached_keys_with_value = Rails.cache.read_multi(*raw).transform_keys(&:id) uncached_ids = raw.map(&:id) - cached_keys_with_value.keys klass.reload_stale_associations!(cached_keys_with_value.values) if klass.respond_to?(:reload_stale_associations!)