FIX: add support for pipelined and multi redis commands (#16682)

Latest redis interoduces a block form of multi / pipelined, this was incorrectly
passed through and not namespaced.

Fix also updates logster, we held off on upgrading it due to missing functions
This commit is contained in:
Sam
2022-05-10 08:19:02 +10:00
committed by GitHub
parent 919f71537e
commit 2df3c65ba9
9 changed files with 89 additions and 28 deletions

View File

@ -93,9 +93,9 @@ class DistributedMutex
got_lock = false
else
result =
redis.multi do
redis.set key, expire_time.to_s
redis.expireat key, expire_time + 1
redis.multi do |transaction|
transaction.set key, expire_time.to_s
transaction.expireat key, expire_time + 1
end
got_lock = !result.nil?
@ -112,9 +112,11 @@ class DistributedMutex
current_expire_time = redis.get key
if current_expire_time == expire_time.to_s
# MULTI is the way redis ensures the watched key
# has not changed by the time it is deleted
result =
redis.multi do
redis.del key
redis.multi do |transaction|
transaction.del key
end
return !result.nil?
else