Skip to content

Commit

Permalink
update tracker_time_key existance check to work with Redis 4.2 (addre…
Browse files Browse the repository at this point in the history
…ss deprecation warning)
  • Loading branch information
baffers authored and danmayer committed Jun 29, 2020
1 parent 9f9154c commit 201a154
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/coverband/collectors/view_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 201a154

Please sign in to comment.