[fix] fix bugs introduced by commit 0a2fde19d0 from dalf/searchpy4

This commit is contained in:
Alexandre Flament 2016-12-30 18:08:48 +01:00
parent 28d51fd063
commit 5a9551925d

View File

@ -65,7 +65,7 @@ def send_http_request(engine, request_params, start_time, timeout_limit):
time_after_request = time() time_after_request = time()
search_duration = time_after_request - start_time search_duration = time_after_request - start_time
if search_duration > timeout_limit + timeout_overhead: if search_duration > timeout_limit + timeout_overhead:
raise Timeout(response=response) raise requests.exceptions.Timeout(response=response)
with threading.RLock(): with threading.RLock():
# no error : reset the suspend variables # no error : reset the suspend variables
@ -129,7 +129,7 @@ def search_one_request_safe(engine_name, query, request_params, result_container
"(search duration : {1} s, timeout: {2} s) : {3}" "(search duration : {1} s, timeout: {2} s) : {3}"
.format(engine_name, search_duration, timeout_limit, e.__class__.__name__)) .format(engine_name, search_duration, timeout_limit, e.__class__.__name__))
requests_exception = True requests_exception = True
if (issubclass(e.__class__, requests.exceptions.RequestException)): elif (issubclass(e.__class__, requests.exceptions.RequestException)):
# other requests exception # other requests exception
logger.exception("engine {0} : requests exception" logger.exception("engine {0} : requests exception"
"(search duration : {1} s, timeout: {2} s) : {3}" "(search duration : {1} s, timeout: {2} s) : {3}"