summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2016-11-05 13:45:20 +0100
committerAlexandre Flament <alex@al-f.net>2016-11-05 13:45:20 +0100
commit01e2648e93e718f84c77aed16326a14f2b498a2e (patch)
tree222bcbad1ae2e03c7c3d9837f516f73e19cd3d96 /searx/webapp.py
parent51eafdd471fe989accc060f3ebd8efba0d9b6a71 (diff)
Simplify search.py, basically updated PR #518
The timeouts in settings.yml is about the total time (not only the HTTP request but also the prepare the request and parsing the response) It was more or less the case before since the threaded_requests function ignores the thread after the timeout even the HTTP request is ended. New / changed stats : * page_load_time : record the HTTP request time * page_load_count: the number of HTTP request * engine_time : the execution total time of an engine * engine_time_count : the number of "engine_time" measure The avg response times in the preferences are the engine response time (engine_load_time / engine_load_count) To sum up : * Search.search() filters the engines that can't process the request * Search.search() call search_multiple_requests function * search_multiple_requests creates one thread per engine, each thread runs the search_one_request function * search_one_request calls the request function, make the HTTP request, calls the response function, extends the result_container * search_multiple_requests waits for the the thread to finish (or timeout)
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index d3d5bb51e..bd61a1a61 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -593,6 +593,8 @@ def preferences():
if e.timeout > settings['outgoing']['request_timeout']:
stats[e.name]['warn_timeout'] = True
+ # get first element [0], the engine time,
+ # and then the second element [1] : the time (the first one is the label)
for engine_stat in get_engines_stats()[0][1]:
stats[engine_stat.get('name')]['time'] = round(engine_stat.get('avg'), 3)
if engine_stat.get('avg') > settings['outgoing']['request_timeout']: