DEV: Upgrade Redis to 4.2.1.

This commit is contained in:
Guo Xiang Tan
2020-06-15 09:57:44 +08:00
parent 1303e89a72
commit 0ff86b00cb
7 changed files with 12 additions and 40 deletions

View File

@@ -43,7 +43,7 @@ class AdminConfirmation
end
def self.exists_for?(user_id)
Discourse.redis.exists "admin-confirmation:#{user_id}"
Discourse.redis.exists? "admin-confirmation:#{user_id}"
end
def self.find_by_code(token)

View File

@@ -56,7 +56,7 @@ class Cache
def exist?(name)
key = normalize_key(name)
redis.exists(key)
redis.exists?(key)
end
# this removes a bunch of stuff we do not need like instrumentation and versioning

View File

@@ -487,7 +487,7 @@ module Discourse
end
def self.readonly_mode?(keys = READONLY_KEYS)
recently_readonly? || Discourse.redis.exists(*keys)
recently_readonly? || Discourse.redis.exists?(*keys)
end
def self.pg_readonly_mode?

View File

@@ -207,17 +207,14 @@ class DiscourseRedis
end
end
# Implement our own because https://github.com/redis/redis-rb/issues/698 has stalled
def exists(*keys)
keys.map! { |a| "#{namespace}:#{a}" } if @namespace
def exists(*args)
args.map! { |a| "#{namespace}:#{a}" } if @namespace
DiscourseRedis.ignore_readonly { @redis.exists(*args) }
end
DiscourseRedis.ignore_readonly do
@redis.synchronize do |client|
client.call([:exists, *keys]) do |value|
value > 0
end
end
end
def exists?(*args)
args.map! { |a| "#{namespace}:#{a}" } if @namespace
DiscourseRedis.ignore_readonly { @redis.exists?(*args) }
end
def mget(*args)