Skip to content

Commit 89098f2

Browse files
committed
Debug fetch_multi leaks
1 parent 78d5bf4 commit 89098f2

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

lib/identity_cache/cache_fetcher.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,32 @@ def clear
6767
def fetch_multi(keys, &block)
6868
results = cas_multi(keys, &block)
6969
results = add_multi(keys, &block) if results.nil?
70+
71+
# binding.pry
72+
73+
def do_division_by_zero; 5 / 0; end
74+
# begin
75+
# do_division_by_zero
76+
# rescue => exception
77+
# puts "catch_fetcher - caught the division_by_zero exception in fetch_multi method"
78+
# puts exception.backtrace
79+
# # raise # always reraise
80+
# end
81+
82+
keys.each do |k|
83+
puts "CacheFetcher - Found Product key: #{k}" if k.include?(":blob:Product:")
84+
85+
if k.include?(":blob:Product:")
86+
begin
87+
do_division_by_zero
88+
rescue => exception
89+
puts "CacheFetcher - caught the Product key :blob:Product: with exceptions in fetch_multi method"
90+
puts exception.backtrace
91+
# raise # always reraise
92+
end
93+
end
94+
95+
end
7096
results
7197
end
7298

lib/identity_cache/fallback_fetcher.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ def clear
2222

2323
def fetch_multi(keys)
2424
results = @cache_backend.read_multi(*keys)
25+
26+
# binding.pry
27+
def do_division_by_zero; 5 / 0; end
28+
begin
29+
do_division_by_zero
30+
rescue => exception
31+
puts "catch_fetcher - caught the division_by_zero exception in fetch_multi method"
32+
puts exception.backtrace
33+
# raise # always reraise
34+
end
35+
2536
missed_keys = keys - results.keys
2637
unless missed_keys.empty?
2738
replacement_results = yield missed_keys

lib/identity_cache/memoized_cache_proxy.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ def fetch_multi(*keys)
106106
result = ActiveSupport::Notifications.instrument("cache_fetch_multi.identity_cache") do |payload|
107107
payload[:resolve_miss_time] = 0.0
108108

109+
keys.each do |k|
110+
puts "MemoizedCacheProxy - Found Product key: #{k}" if k.include?(":blob:Product:")
111+
end
112+
109113
result = fetch_multi_memoized(keys) do |non_memoized_keys|
110114
memo_miss_keys = non_memoized_keys
111115
@cache_fetcher.fetch_multi(non_memoized_keys) do |missing_keys|

0 commit comments

Comments
 (0)