Fix to make the `is_readonly?` method compatible with the redis gem both pre and post v4.0 when the `client` attribute was removed - closes #208

Fix to make the is_readonly? method compatible with the redis gem both pre and post v4.0 when the client attribute was removed - closes #208

diff --git a/CHANGELOG b/CHANGELOG
index 0e0c204..6645622 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Unreleased
+
+  - FIX: In the redis backend make the `is_readonly?` method compatible with the redis gem both pre and post v4.0 when the `client` attribute was removed
+
 30-04-2019
 
 - Version 2.2.1
diff --git a/lib/message_bus/backends/redis.rb b/lib/message_bus/backends/redis.rb
index cfb2154..a4751b0 100644
--- a/lib/message_bus/backends/redis.rb
+++ b/lib/message_bus/backends/redis.rb
@@ -433,10 +433,11 @@ LUA
         key = "__mb_is_readonly"
 
         begin
+          # disconnect to force a reconnect when attempting to set the key
           # in case we are not connected to the correct server
           # which can happen when sharing ips
-          pub_redis.client.reconnect
-          pub_redis.client.call([:set, key, '1'])
+          pub_redis.disconnect!
+          pub_redis.set(key, '1')
           false
         rescue ::Redis::CommandError => e
           return true if e.message =~ /^READONLY/

GitHub sha: e2caee33