Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix to make the is_readonly? method compatible with the redis gem b…
…oth pre and post v4.0 when the `client` attribute was removed - closes #208
  • Loading branch information
Chris Hilton authored and SamSaffron committed Jun 6, 2019
1 parent fff2311 commit e2caee3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions 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
Expand Down
5 changes: 3 additions & 2 deletions lib/message_bus/backends/redis.rb
Expand Up @@ -433,10 +433,11 @@ def is_readonly?
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/
Expand Down

0 comments on commit e2caee3

Please sign in to comment.