FIX: correct readonly timeout

So it only applies in readonly mode
This commit is contained in:
Sam 2018-09-20 15:18:35 +10:00
parent ad74eea50d
commit fd8bf5d2cb

View File

@ -22,10 +22,12 @@ class DistributedMutex
while !try_to_get_lock
sleep 0.001
attempts += 1
# in readonly we will never be able to get a lock
if @using_global_redis && attempts > CHECK_READONLY_ATTEMPT
raise Discourse::ReadOnly
if @using_global_redis && Discourse.recently_readonly?
attempts += 1
if attempts > CHECK_READONLY_ATTEMPT
raise Discourse::ReadOnly
end
end
end