Skip to content

Commit 9d2135b

Browse files
author
Robert Kirberich
committed
Don’t attempt to close the connection to redis
py-redis uses connection pooling, removing the need for handling connections explicitly. There might still be special cases where closing a connection is needed, but the current behaviour breaks for standard use cases where the caching adapter gets closed (for example when using it in a context manager), so this seems like an easy improvement.
1 parent 1c8a892 commit 9d2135b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cachecontrol/caches/redis_cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ def clear(self):
3939
self.conn.delete(key)
4040

4141
def close(self):
42-
self.conn.disconnect()
42+
"""Redis uses connection pooling, no need to close the connection."""
43+
pass

0 commit comments

Comments
 (0)