summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2015-05-30 12:15:23 +0200
committerAlexandre Flament <alex@al-f.net>2015-05-30 12:15:23 +0200
commitd4d2dd9cb30df9a7d3ffcaf574b59f66d0f8917c (patch)
tree7c1a48f69730c1a439c4576e86ffc90472f4ca35 /searx/webapp.py
parente19eeeefa0358d4f39b6708ac4bdb036f2c4e733 (diff)
downloadsearxng-d4d2dd9cb30df9a7d3ffcaf574b59f66d0f8917c.tar.gz
searxng-d4d2dd9cb30df9a7d3ffcaf574b59f66d0f8917c.zip
[enh] oscar theme: display engine response times in the preferences
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 3ef5a72c8..8587d546a 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -623,6 +623,24 @@ def preferences():
resp.set_cookie('theme', theme, max_age=cookie_max_age)
return resp
+
+ # stats for preferences page
+ stats = {}
+
+ for c in categories:
+ for e in categories[c]:
+ stats[e.name] = {'time': None,
+ 'warn_timeout': False,
+ 'warn_time': False}
+ if e.timeout > settings['server']['request_timeout']:
+ stats[e.name]['warn_timeout'] = True
+
+ 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['server']['request_timeout']:
+ stats[engine_stat.get('name')]['warn_time'] = True
+ # end of stats
+
return render('preferences.html',
locales=settings['locales'],
current_locale=get_locale(),
@@ -630,6 +648,7 @@ def preferences():
image_proxy=image_proxy,
language_codes=language_codes,
engines_by_category=categories,
+ stats=stats,
blocked_engines=blocked_engines,
autocomplete_backends=autocomplete_backends,
shortcuts={y: x for x, y in engine_shortcuts.items()},