mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 19:32:43 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user