Log failed attempts at closing the failed thrift connections

This commit is contained in:
Honza Král
2014-09-27 17:34:00 +02:00
parent 76995a6582
commit 40f7fc5a01
+8 -2
View File
@@ -1,6 +1,7 @@
from __future__ import absolute_import
from socket import timeout as SocketTimeout
import time
import logging
try:
from .esthrift import Rest
@@ -16,6 +17,8 @@ except ImportError:
from ..exceptions import ConnectionError, ImproperlyConfigured
from .pooling import PoolingConnection
logger = logging.getLogger('elasticsearch')
class ThriftConnection(PoolingConnection):
"""
Connection using the `thrift` protocol to communicate with elasticsearch.
@@ -69,8 +72,11 @@ class ThriftConnection(PoolingConnection):
try:
# try closing transport socket
tclient.transport.close()
except:
pass
except Exception as e:
logger.warning(
'Exception %s occured when closing a failed thrift connection.',
e, exc_info=True
)
raise ConnectionError('N/A', str(e), e)
self._release_connection(tclient)