DEV: Upgrade Redis to 4.2.1.

DEV: Upgrade Redis to 4.2.1.

diff --git a/Gemfile.lock b/Gemfile.lock
index e4fd8dd..b181c5e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -310,7 +310,7 @@ GEM
       msgpack (>= 0.4.3)
       optimist (>= 3.0.0)
     rchardet (1.8.0)
-    redis (4.1.4)
+    redis (4.2.1)
     redis-namespace (1.7.0)
       redis (>= 3.0.4)
     regexp_parser (1.7.1)
diff --git a/config/initializers/002-rails_failover.rb b/config/initializers/002-rails_failover.rb
index c8f1cfb..6952bc9 100644
--- a/config/initializers/002-rails_failover.rb
+++ b/config/initializers/002-rails_failover.rb
@@ -70,7 +70,7 @@ if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
   end
 
   RailsFailover::ActiveRecord.register_force_reading_role_callback do
-    Discourse.redis.exists(
+    Discourse.redis.exists?(
       Discourse::PG_READONLY_MODE_KEY,
       Discourse::PG_FORCE_READONLY_MODE_KEY
     )
diff --git a/lib/admin_confirmation.rb b/lib/admin_confirmation.rb
index dc132b7..28f305b 100644
--- a/lib/admin_confirmation.rb
+++ b/lib/admin_confirmation.rb
@@ -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)
diff --git a/lib/cache.rb b/lib/cache.rb
index 9e76ea6..faae643 100644
--- a/lib/cache.rb
+++ b/lib/cache.rb
@@ -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
diff --git a/lib/discourse.rb b/lib/discourse.rb
index 11c10e9..2382acb 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -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?
diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rb
index 096c86b..53a0490 100644
--- a/lib/discourse_redis.rb
+++ b/lib/discourse_redis.rb
@@ -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)
diff --git a/spec/components/discourse_redis_spec.rb b/spec/components/discourse_redis_spec.rb
index 8e44116..abc9a59 100644
--- a/spec/components/discourse_redis_spec.rb
+++ b/spec/components/discourse_redis_spec.rb
@@ -87,31 +87,6 @@ describe DiscourseRedis do
         expect(Discourse.recently_readonly?).to eq(true)
       end
     end
-
-    describe '.exists' do
-      it 'should return false when key is not present' do
-        expect(Discourse.redis.exists('test')).to eq(false)
-      end
-
-      it 'should return false when keys are not present' do
-        expect(Discourse.redis.exists('test', 'test2')).to eq(false)
-      end
-
-      it 'should return true when key is present' do
-        Discourse.redis.set('test', 1)
-
-        expect(Discourse.redis.exists('test')).to eq(true)
-      end
-
-      it 'should return true when any key is present' do
-        Discourse.redis.set('test', 1)
-        Discourse.redis.set('test2', 1)
-
-        expect(Discourse.redis.exists('test')).to eq(true)
-        expect(Discourse.redis.exists('test', 'test2')).to eq(true)
-        expect(Discourse.redis.exists('test2', 'test3')).to eq(true)
-      end
-    end
   end
 
   context '.slave_host' do

GitHub sha: 0ff86b00