summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2019-02-01 11:04:30 -0800
committerAndy McCurdy <andy@andymccurdy.com>2019-02-01 11:04:30 -0800
commite6157620edd7b136bdf1bca721d3d2b879e97f9d (patch)
treee5d41f5f8fa3e991b01525d9bdf1404de3d20f09
parent0dc6c50a11cf9f0cf18e5c0515154ee060a27035 (diff)
downloadredis-py-e6157620edd7b136bdf1bca721d3d2b879e97f9d.tar.gz
readd the connection destructor
Since Connection.disconnect() now verifies that the current process owns the connection before shutting the socket down we can safely readd the destructor just to make sure things are really cleaned up
-rwxr-xr-xredis/connection.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/redis/connection.py b/redis/connection.py
index ee0b92a..1ecba61 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -471,6 +471,12 @@ class Connection(object):
def __repr__(self):
return self.description_format % self._description_args
+ def __del__(self):
+ try:
+ self.disconnect()
+ except Exception:
+ pass
+
def register_connect_callback(self, callback):
self._connect_callbacks.append(callback)