Make sure we clean up correctly after failed thrift connection
This commit is contained in:
@@ -56,6 +56,7 @@ class ThriftConnection(PoolingConnection):
|
|||||||
parameters=params, body=body)
|
parameters=params, body=body)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
tclient = None
|
||||||
try:
|
try:
|
||||||
tclient = self._get_connection()
|
tclient = self._get_connection()
|
||||||
response = tclient.execute(request)
|
response = tclient.execute(request)
|
||||||
@@ -64,6 +65,7 @@ class ThriftConnection(PoolingConnection):
|
|||||||
self.log_request_fail(method, url, body, time.time() - start, exception=e)
|
self.log_request_fail(method, url, body, time.time() - start, exception=e)
|
||||||
raise ConnectionError('N/A', str(e), e)
|
raise ConnectionError('N/A', str(e), e)
|
||||||
finally:
|
finally:
|
||||||
|
if tclient:
|
||||||
self._release_connection(tclient)
|
self._release_connection(tclient)
|
||||||
|
|
||||||
if not (200 <= response.status < 300) and response.status not in ignore:
|
if not (200 <= response.status < 300) and response.status not in ignore:
|
||||||
|
|||||||
Reference in New Issue
Block a user