summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/connection.py')
-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)