PERF: Reduce hit to Redis server when keeping a site in reaonly mode.

This commit is contained in:
Guo Xiang Tan 2019-02-19 10:29:08 +08:00
parent 86a2172bda
commit c29076152d

View File

@ -333,9 +333,7 @@ module Discourse
@dbs.each do |db|
RailsMultisite::ConnectionManagement.with_connection(db) do
if readonly_mode?(key)
$redis.expire(key, READONLY_MODE_KEY_TTL)
else
if !$redis.expire(key, READONLY_MODE_KEY_TTL)
@dbs.delete(db)
end
end