From 44060a48a0ec08595a8d83aa597286e50634ca30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Mon, 8 Sep 2014 12:08:45 +0200 Subject: [PATCH] Catch socket.timeout in ThriftConnection Fixes #121, thanks traxair! --- elasticsearch/connection/thrift.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elasticsearch/connection/thrift.py b/elasticsearch/connection/thrift.py index d87e559e..f0d92b2a 100644 --- a/elasticsearch/connection/thrift.py +++ b/elasticsearch/connection/thrift.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from socket import timeout as SocketTimeout import time try: @@ -61,7 +62,7 @@ class ThriftConnection(PoolingConnection): tclient = self._get_connection() response = tclient.execute(request) duration = time.time() - start - except TException as e: + except (TException, SocketTimeout) as e: self.log_request_fail(method, url, body, time.time() - start, exception=e) raise ConnectionError('N/A', str(e), e) finally: