mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2025-01-03 22:53:43 +01:00
Log what's causing the fetch_value errors.
Port of https://github.com/mastodon/mastodon/issues/23644#issuecomment-1461863404
This commit is contained in:
parent
3158b0ac17
commit
2d076504d9
1 changed files with 18 additions and 1 deletions
|
@ -31,7 +31,24 @@ module CacheConcern
|
||||||
def cache_collection(raw, klass)
|
def cache_collection(raw, klass)
|
||||||
return raw unless klass.respond_to?(:with_includes)
|
return raw unless klass.respond_to?(:with_includes)
|
||||||
|
|
||||||
raw = raw.cache_ids.to_a if raw.is_a?(ActiveRecord::Relation)
|
begin
|
||||||
|
raw = raw.cache_ids.to_a if raw.is_a?(ActiveRecord::Relation)
|
||||||
|
rescue NoMethodError
|
||||||
|
culprit = raw.find do |item|
|
||||||
|
Rails.cache.read(item)
|
||||||
|
false
|
||||||
|
rescue NoMethodError
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
$stderr.puts "fetch_value issue culprit: #{culprit.inspect}\n"
|
||||||
|
|
||||||
|
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))
|
||||||
|
$stderr.puts "base64 marshal of culprit: #{Base64.encode64(raw_marshal)}"
|
||||||
|
end
|
||||||
|
|
||||||
return [] if raw.empty?
|
return [] if raw.empty?
|
||||||
|
|
||||||
cached_keys_with_value = Rails.cache.read_multi(*raw).transform_keys(&:id)
|
cached_keys_with_value = Rails.cache.read_multi(*raw).transform_keys(&:id)
|
||||||
|
|
Loading…
Reference in a new issue