diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b09975..97cb65b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- Revalidate connection in `RedisClient#connected?` - Eagerly fail if `db:` isn't an Integer. #151. # 0.18.0 diff --git a/lib/redis_client.rb b/lib/redis_client.rb index a323a55..52ad446 100644 --- a/lib/redis_client.rb +++ b/lib/redis_client.rb @@ -222,17 +222,18 @@ def with(_options = nil) def timeout=(timeout) super - raw_connection.read_timeout = raw_connection.write_timeout = timeout if connected? + @raw_connection&.read_timeout = timeout + @raw_connection&.write_timeout = timeout end def read_timeout=(timeout) super - raw_connection.read_timeout = timeout if connected? + @raw_connection&.read_timeout = timeout end def write_timeout=(timeout) super - raw_connection.write_timeout = timeout if connected? + @raw_connection&.write_timeout = timeout end def pubsub @@ -386,7 +387,7 @@ def zscan(key, *args, **kwargs, &block) end def connected? - @raw_connection&.connected? + @raw_connection&.revalidate end def close