forked from Icycoide/searxng
[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.
This commit is contained in:
parent
cfcbc3a5c3
commit
554a21e1d0
4 changed files with 70 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue