on master help sign in
[enh] admin configurable suspend time of errored engines - closes #1266
commitf7bb45e8912a8529e59146afd3b9cf3413d70a67 authorAdam Tauber <asciimoo@gmail.com> dateSun 19 Aug 2018, 15:29 (8 years ago) parent69d1dd3
3 files changed+8−3
searx/preferences.py+3−1 searx/search.py+2−1 searx/settings.yml+3−1
searx/preferences.py+3−1
@@ -264,7 +264,9 @@ class Preferences(object):
264264 'False': False,
265265 'True': True}),
266266 'doi_resolver': MultipleChoiceSetting(['oadoi.org'], choices=DOI_RESOLVERS),
267− 'oscar-style': EnumStringSetting(settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'), choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
267+ 'oscar-style': EnumStringSetting(
268+ settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'),
269+ choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
268270 }
269271
270272 self.engines = EnginesSetting('engines', choices=engines)
searx/search.py+2−1
@@ -147,7 +147,8 @@ def search_one_request_safe(engine_name, query, request_params, result_container
147147 if requests_exception:
148148 # update continuous_errors / suspend_end_time
149149 engine.continuous_errors += 1
150− engine.suspend_end_time = time() + min(60, engine.continuous_errors)
150+ engine.suspend_end_time = time() + min(settings['search']['max_ban_time_on_fail'],
151+ engine.continuous_errors*settings['search']['ban_time_on_fail'])
151152 else:
152153 # no HTTP error (perhaps an engine error)
153154 # anyway, reset the suspend variables
searx/settings.yml+3−1
@@ -6,6 +6,8 @@ search:
66 safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
77 autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
88 language : "en-US"
9+ ban_time_on_fail : 5 # ban time in seconds after engine errors
10+ max_ban_time_on_fail : 120 # max ban time in seconds after engine errors
911
1012server:
1113 port : 8888
@@ -21,7 +23,7 @@ ui:
2123 default_theme : oscar # ui theme
2224 default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section
2325 theme_args :
24− oscar_style : logicodev-dark # default style of oscar
26+ oscar_style : logicodev # default style of oscar
2527
2628# searx supports result proxification using an external service: https://github.com/asciimoo/morty
2729# uncomment below section if you have running morty proxy