summaryrefslogtreecommitdiff
path: root/searx/results.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2019-07-17 10:38:45 +0200
committerGitHub <noreply@github.com>2019-07-17 10:38:45 +0200
commit554a21e1d07f3b434b5097b4e3d49e1403be7527 (patch)
treee4917091b8e32690256fabf64addfc1ea187ba67 /searx/results.py
parentcfcbc3a5c344037fb5423c14223e72578170a234 (diff)
downloadsearxng-554a21e1d07f3b434b5097b4e3d49e1403be7527.tar.gz
searxng-554a21e1d07f3b434b5097b4e3d49e1403be7527.zip
[enh] Add Server-Timing header (#1637)
Server Timing specification: https://www.w3.org/TR/server-timing/ In the browser Dev Tools, focus on the main request, there are the responses per engine in the Timing tab.
Diffstat (limited to 'searx/results.py')
-rw-r--r--searx/results.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/searx/results.py b/searx/results.py
index cb204a682..d3f2ecd0d 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -136,6 +136,7 @@ class ResultContainer(object):
self._ordered = False
self.paging = False
self.unresponsive_engines = set()
+ self.timings = []
def extend(self, engine_name, results):
for result in list(results):
@@ -319,3 +320,13 @@ class ResultContainer(object):
def add_unresponsive_engine(self, engine_error):
self.unresponsive_engines.add(engine_error)
+
+ def add_timing(self, engine_name, engine_time, page_load_time):
+ self.timings.append({
+ 'engine': engines[engine_name].shortcut,
+ 'total': engine_time,
+ 'load': page_load_time
+ })
+
+ def get_timings(self):
+ return self.timings