summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-05-19 11:24:18 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-05-22 15:17:18 +0200
commitec834935381e5cfb4ebc3820ed2f668d0fc7855d (patch)
tree352d2253c3dc32f5b62e320537071c00f7b87858 /searx/webapp.py
parent2f76b570ab4dae3b2c85aaddddc41831548b1ff8 (diff)
[fix] offline engine: don't crash on time recording
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 0ea82d098..7df12af18 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -568,7 +568,7 @@ def post_request(response):
timings_total = ['total_' + str(i) + '_' + v['engine'] +
';dur=' + str(round(v['total'] * 1000, 3)) for i, v in enumerate(timings)]
timings_load = ['load_' + str(i) + '_' + v['engine'] +
- ';dur=' + str(round(v['load'] * 1000, 3)) for i, v in enumerate(timings)]
+ ';dur=' + str(round(v['load'] * 1000, 3)) for i, v in enumerate(timings) if v.get('load')]
timings_all = timings_all + timings_total + timings_load
response.headers.add('Server-Timing', ', '.join(timings_all))
return response
@@ -923,9 +923,9 @@ def preferences():
result_count = int(result_count_sum / float(successful_count)) if successful_count else 0
stats[e.name] = {
- 'time': median if median else None,
- 'rate80': rate80 if rate80 else None,
- 'rate95': rate95 if rate95 else None,
+ 'time': median,
+ 'rate80': rate80,
+ 'rate95': rate95,
'warn_timeout': e.timeout > settings['outgoing']['request_timeout'],
'supports_selected_language': _is_selected_language_supported(e, request.preferences),
'result_count': result_count,