Log failed attempts at closing the failed thrift connections
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from socket import timeout as SocketTimeout
|
from socket import timeout as SocketTimeout
|
||||||
import time
|
import time
|
||||||
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .esthrift import Rest
|
from .esthrift import Rest
|
||||||
@@ -16,6 +17,8 @@ except ImportError:
|
|||||||
from ..exceptions import ConnectionError, ImproperlyConfigured
|
from ..exceptions import ConnectionError, ImproperlyConfigured
|
||||||
from .pooling import PoolingConnection
|
from .pooling import PoolingConnection
|
||||||
|
|
||||||
|
logger = logging.getLogger('elasticsearch')
|
||||||
|
|
||||||
class ThriftConnection(PoolingConnection):
|
class ThriftConnection(PoolingConnection):
|
||||||
"""
|
"""
|
||||||
Connection using the `thrift` protocol to communicate with elasticsearch.
|
Connection using the `thrift` protocol to communicate with elasticsearch.
|
||||||
@@ -69,8 +72,11 @@ class ThriftConnection(PoolingConnection):
|
|||||||
try:
|
try:
|
||||||
# try closing transport socket
|
# try closing transport socket
|
||||||
tclient.transport.close()
|
tclient.transport.close()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
logger.warning(
|
||||||
|
'Exception %s occured when closing a failed thrift connection.',
|
||||||
|
e, exc_info=True
|
||||||
|
)
|
||||||
raise ConnectionError('N/A', str(e), e)
|
raise ConnectionError('N/A', str(e), e)
|
||||||
|
|
||||||
self._release_connection(tclient)
|
self._release_connection(tclient)
|
||||||
|
|||||||
Reference in New Issue
Block a user