Redis calls investigation
ActiveRecord::Base.connection.clear_query_cache
ActiveRecord::Base.connection.disable_query_cache!
ActiveSupport::Notifications.subscribe("sql.active_record") do |_, _, _, _, details|
puts caller.reject { |m| m =~ /initializers|activesupport|activerecord|newrelic_rpm|2\.1\.0|1\.9\.1/i }.join("\n")
puts "---- sql: #{details[:sql]}"
puts "*" * 50
end
Rails.cache.define_singleton_method :fetch do |name, options, &block|
puts "=" * 50
puts "---- key: #{name}"
puts caller.reject { |m| m =~ /resources|2\.1\.0|1\.9\.1/i }.join("\n")
puts "=" * 50
options = merged_options(options)
key = namespaced_key(name, options)
entry = instrument(:read, name, options) do |payload|
payload[:super_operation] = :fetch if payload
read_entry(key, options)
end
if entry
instrument(:fetch_hit, name, options) { |payload| }
entry.value
else
result = instrument(:generate, name, options) do |payload|
block.call
end
write(name, result, options) if @store_available
result
end
end
@order = Order.find 26742659
@offer = Offer.find 95012699
@driver = Driver.find 688
# @order = Order.in_progress.where('driver_id is not null').last
# @offer = @order.offers.last
version = '3.1'
# @driver = @order.driver
5.times { p '=' * 50 }
decorator = Dbx::OrderDecorator.new(@order)
result = decorator.get_order(@offer, version, @driver)