mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +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:
parent
919f71537e
commit
2df3c65ba9
9 changed files with 89 additions and 28 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue