Skip to content

Commit 59ab61f

Browse files
committed
fix: add TimeoutError handling in get_connection()
In get_connection() we can implicitly call read on a connection. This can timeout of the underlying TCP session is gone. With this change we remove it from the connection pool and get a new connection.
1 parent 2c9f41f commit 59ab61f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

redis/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ def get_connection(self, command_name, *keys, **options):
13841384
try:
13851385
if connection.can_read():
13861386
raise ConnectionError('Connection has data')
1387-
except ConnectionError:
1387+
except (ConnectionError, TimeoutError):
13881388
connection.disconnect()
13891389
connection.connect()
13901390
if connection.can_read():

0 commit comments

Comments
 (0)