Skip to content

Commit bea00b1

Browse files
fix: catch OSError on asyncio (#2412)
1 parent 9d70719 commit bea00b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

redis/asyncio/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ async def get_connection(self, command_name, *keys, **options):
14451445
try:
14461446
if await connection.can_read_destructive():
14471447
raise ConnectionError("Connection has data") from None
1448-
except ConnectionError:
1448+
except (ConnectionError, OSError):
14491449
await connection.disconnect()
14501450
await connection.connect()
14511451
if await connection.can_read_destructive():
@@ -1646,7 +1646,7 @@ async def get_connection(self, command_name, *keys, **options):
16461646
try:
16471647
if await connection.can_read_destructive():
16481648
raise ConnectionError("Connection has data") from None
1649-
except ConnectionError:
1649+
except (ConnectionError, OSError):
16501650
await connection.disconnect()
16511651
await connection.connect()
16521652
if await connection.can_read_destructive():

0 commit comments

Comments
 (0)