|
@@ -20,6 +20,7 @@ import sys
|
20
|
20
|
import threading
|
21
|
21
|
from time import time
|
22
|
22
|
from uuid import uuid4
|
|
23
|
+from flask_babel import gettext
|
23
|
24
|
import requests.exceptions
|
24
|
25
|
import searx.poolrequests as requests_lib
|
25
|
26
|
from searx.engines import (
|
|
@@ -133,18 +134,21 @@ def search_one_request_safe(engine_name, query, request_params, result_container
|
133
|
134
|
requests_exception = False
|
134
|
135
|
|
135
|
136
|
if (issubclass(e.__class__, requests.exceptions.Timeout)):
|
|
137
|
+ result_container.add_unresponsive_engine((engine_name, gettext('timeout')))
|
136
|
138
|
# requests timeout (connect or read)
|
137
|
139
|
logger.error("engine {0} : HTTP requests timeout"
|
138
|
140
|
"(search duration : {1} s, timeout: {2} s) : {3}"
|
139
|
141
|
.format(engine_name, search_duration, timeout_limit, e.__class__.__name__))
|
140
|
142
|
requests_exception = True
|
141
|
143
|
elif (issubclass(e.__class__, requests.exceptions.RequestException)):
|
|
144
|
+ result_container.add_unresponsive_engine((engine_name, gettext('request exception')))
|
142
|
145
|
# other requests exception
|
143
|
146
|
logger.exception("engine {0} : requests exception"
|
144
|
147
|
"(search duration : {1} s, timeout: {2} s) : {3}"
|
145
|
148
|
.format(engine_name, search_duration, timeout_limit, e))
|
146
|
149
|
requests_exception = True
|
147
|
150
|
else:
|
|
151
|
+ result_container.add_unresponsive_engine((engine_name, gettext('unexpected crash')))
|
148
|
152
|
# others errors
|
149
|
153
|
logger.exception('engine {0} : exception : {1}'.format(engine_name, e))
|
150
|
154
|
|