Skip to content

Commit

Permalink
Removed: Rails reloading Redis cache after patch (obsolete.)
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Jun 27, 2019
1 parent a8860c5 commit 3769229
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
22 changes: 0 additions & 22 deletions lib/ddtrace/contrib/rails/framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,6 @@ def self.activate_active_support!(config)
service_name: config[:cache_service],
tracer: config[:tracer]
)

reload_cache_store
end

def self.reload_cache_store
return unless Datadog.registry[:redis] &&
Datadog.registry[:redis].patcher.patched?

return unless defined?(::ActiveSupport::Cache::RedisStore) &&
::Rails.respond_to?(:cache) &&
::Rails.cache.is_a?(::ActiveSupport::Cache::RedisStore)

Tracer.log.debug('Reloading redis cache store')

# backward compatibility: Rails 3.x doesn't have `cache=` method
cache_store = ::Rails.configuration.cache_store
cache_instance = ::ActiveSupport::Cache.lookup_store(cache_store)
if ::Rails::VERSION::MAJOR.to_i == 3
silence_warnings { Object.const_set 'RAILS_CACHE', cache_instance }
elsif ::Rails::VERSION::MAJOR.to_i > 3
::Rails.cache = cache_instance
end
end

def self.activate_active_record!(config)
Expand Down
5 changes: 0 additions & 5 deletions lib/ddtrace/contrib/redis/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ def patch
require 'ddtrace/contrib/redis/quantize'

patch_redis_client

# Reload the Rails cache, if defined, so instrumentation is available.
if Datadog.registry[:rails] && Datadog.registry[:rails].patcher.patched?
Contrib::Rails::Framework.reload_cache_store
end
rescue StandardError => e
Datadog::Tracer.log.error("Unable to apply Redis integration: #{e}")
end
Expand Down

0 comments on commit 3769229

Please sign in to comment.