mirror of
https://github.com/searxng/searxng.git
synced 2025-12-24 04:30:02 +00:00
[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:
committed by
GitHub
parent
cfcbc3a5c3
commit
554a21e1d0
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user