From 201a154154ca721c3f800ea38eb11247c383d796 Mon Sep 17 00:00:00 2001 From: Shannon Baffoni Date: Tue, 23 Jun 2020 08:06:53 -0700 Subject: [PATCH] update tracker_time_key existance check to work with Redis 4.2 (address deprecation warning) --- lib/coverband/collectors/view_tracker.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/coverband/collectors/view_tracker.rb b/lib/coverband/collectors/view_tracker.rb index 7182dfc0..919a80ed 100644 --- a/lib/coverband/collectors/view_tracker.rb +++ b/lib/coverband/collectors/view_tracker.rb @@ -108,7 +108,7 @@ def clear_file!(filename) end def report_views_tracked - redis_store.set(tracker_time_key, Time.now.to_i) unless @one_time_timestamp || redis_store.exists(tracker_time_key) + redis_store.set(tracker_time_key, Time.now.to_i) unless @one_time_timestamp || tracker_time_key_exists? @one_time_timestamp = true reported_time = Time.now.to_i views_to_record.each do |file| @@ -145,6 +145,14 @@ def redis_store store.raw_store end + def tracker_time_key_exists? + if defined?(redis_store.exists?) + redis_store.exists?(tracker_time_key) + else + redis_store.exists(tracker_time_key) + end + end + def tracker_key 'render_tracker_2' end