Skip to content

Commit 76995a6

Browse files
committed
ignore exceptions when trying to close transport socket
1 parent 2a1aac8 commit 76995a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elasticsearch/connection/thrift.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
6666
except (TException, SocketTimeout) as e:
6767
self.log_request_fail(method, url, body, time.time() - start, exception=e)
6868
if tclient:
69-
tclient.transport.close()
69+
try:
70+
# try closing transport socket
71+
tclient.transport.close()
72+
except:
73+
pass
7074
raise ConnectionError('N/A', str(e), e)
7175

7276
self._release_connection(tclient)

0 commit comments

Comments
 (0)