From 55a910659665a0672f2f97067bc96d8fb6ee2dc1 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Thu, 30 Apr 2020 13:45:03 -0700 Subject: [PATCH] Implement close method The connection_pool gem is implementing automatic reaping of idle connections. In order to do this generically, clients need to provide a `close` method that the pool can call on reaped connections in order to close the network connection cleanly. mysql2 and dalli already provide `close`. This PR adds this convention to redis-rb. --- lib/redis/client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/redis/client.rb b/lib/redis/client.rb index 9656a0f4d..ea6be56eb 100644 --- a/lib/redis/client.rb +++ b/lib/redis/client.rb @@ -250,6 +250,7 @@ def connected? def disconnect connection.disconnect if connected? end + alias_method :close, :disconnect def reconnect disconnect