Skip to content

Commit

Permalink
DEV: Remove Redis 4.2 warnings. (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxworld committed Jul 14, 2020
1 parent cea53b8 commit 7ad4279
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mini_profiler/storage/redis_store.rb
Expand Up @@ -33,7 +33,7 @@ def load(id)

def set_unviewed(user, id)
key = user_key(user)
if redis.exists(prefixed_id(id))
if redis.call([:exists, prefixed_id(id)]) == 1
expire_at = Process.clock_gettime(Process::CLOCK_MONOTONIC).to_i + redis.ttl(prefixed_id(id))
redis.zadd(key, expire_at, id)
end
Expand All @@ -44,7 +44,7 @@ def set_all_unviewed(user, ids)
key = user_key(user)
redis.del(key)
ids.each do |id|
if redis.exists(prefixed_id(id))
if redis.call([:exists, prefixed_id(id)]) == 1
expire_at = Process.clock_gettime(Process::CLOCK_MONOTONIC).to_i + redis.ttl(prefixed_id(id))
redis.zadd(key, expire_at, id)
end
Expand Down

2 comments on commit 7ad4279

@discoursereviewbot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Régis Hanol posted:

Why not use redis.exists? instead?

@discoursereviewbot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SamSaffron posted:

Backwards compat, exists? is missing from some earlier redis gems.

Please sign in to comment.