From 98b64886761ab2792f0d6c12a11b90306fe6a91c Mon Sep 17 00:00:00 2001 From: dferrazm Date: Fri, 4 Dec 2020 11:17:10 +0100 Subject: [PATCH] Use Redis#exists? to fix deprecation warning When using redis-rb 4+: Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you should use it instead. --- lib/remote_lock/adapters/redis.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/remote_lock/adapters/redis.rb b/lib/remote_lock/adapters/redis.rb index 88f5d52..ff6d2f3 100644 --- a/lib/remote_lock/adapters/redis.rb +++ b/lib/remote_lock/adapters/redis.rb @@ -18,7 +18,7 @@ def store(key, expires_in_seconds) # check if another client has the key. # it's important to still run a transaction to clear the watch. - have_competition = @connection.exists(key) + have_competition = @connection.respond_to?(:exists?) ? @connection.exists?(key) : @connection.exists(key) !! @connection.multi do break if have_competition