FIX: remove dependency on present? in distributed_mutex lib

This commit is contained in:
Neil Lalonde 2019-08-07 15:39:48 -04:00
parent 78500fb770
commit 5f87089b67
1 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ class DistributedMutex
current_expire_time = redis.get key
if current_expire_time.present? && current_expire_time.to_i > now
if current_expire_time && current_expire_time.to_i > now
redis.unwatch
got_lock = false
@ -94,7 +94,7 @@ class DistributedMutex
redis.expire key, validity
end
got_lock = result.present?
got_lock = !result.nil?
end
[got_lock, expire_time]
@ -109,7 +109,7 @@ class DistributedMutex
redis.multi do
redis.del key
end
return result.present?
return !result.nil?
else
redis.unwatch
return false