From 3a9f40789eb88c66c775535ad4d70734f0c235d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Ucar?= Date: Mon, 10 Jan 2022 12:20:20 +0100 Subject: [PATCH] get_connection: catch OSError too (#1832) --- redis/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/connection.py b/redis/connection.py index 8fdb4bdf8c..4178f67c57 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -1317,7 +1317,7 @@ def get_connection(self, command_name, *keys, **options): try: if connection.can_read(): raise ConnectionError("Connection has data") - except ConnectionError: + except (ConnectionError, OSError): connection.disconnect() connection.connect() if connection.can_read():