summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2018-08-19 15:29:52 +0200
committerAdam Tauber <asciimoo@gmail.com>2018-08-19 15:30:12 +0200
commitf7bb45e8912a8529e59146afd3b9cf3413d70a67 (patch)
treee56e207975db5bb2d09bd0053e1e7519f0e15d5c /searx
parent69d1dd3f862ee491518bc837325a498e66f925d0 (diff)
downloadsearxng-f7bb45e8912a8529e59146afd3b9cf3413d70a67.tar.gz
searxng-f7bb45e8912a8529e59146afd3b9cf3413d70a67.zip
[enh] admin configurable suspend time of errored engines - closes #1266
Diffstat (limited to 'searx')
-rw-r--r--searx/preferences.py4
-rw-r--r--searx/search.py3
-rw-r--r--searx/settings.yml4
3 files changed, 8 insertions, 3 deletions
diff --git a/searx/preferences.py b/searx/preferences.py
index fb46edd63..ed2cc402a 100644
--- a/searx/preferences.py
+++ b/searx/preferences.py
@@ -264,7 +264,9 @@ class Preferences(object):
'False': False,
'True': True}),
'doi_resolver': MultipleChoiceSetting(['oadoi.org'], choices=DOI_RESOLVERS),
- 'oscar-style': EnumStringSetting(settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'), choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
+ 'oscar-style': EnumStringSetting(
+ settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'),
+ choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
}
self.engines = EnginesSetting('engines', choices=engines)
diff --git a/searx/search.py b/searx/search.py
index 945f32197..f50391f16 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -147,7 +147,8 @@ def search_one_request_safe(engine_name, query, request_params, result_container
if requests_exception:
# update continuous_errors / suspend_end_time
engine.continuous_errors += 1
- engine.suspend_end_time = time() + min(60, engine.continuous_errors)
+ engine.suspend_end_time = time() + min(settings['search']['max_ban_time_on_fail'],
+ engine.continuous_errors*settings['search']['ban_time_on_fail'])
else:
# no HTTP error (perhaps an engine error)
# anyway, reset the suspend variables
diff --git a/searx/settings.yml b/searx/settings.yml
index 812da7472..2575000c3 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -6,6 +6,8 @@ search:
safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
language : "en-US"
+ ban_time_on_fail : 5 # ban time in seconds after engine errors
+ max_ban_time_on_fail : 120 # max ban time in seconds after engine errors
server:
port : 8888
@@ -21,7 +23,7 @@ ui:
default_theme : oscar # ui theme
default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section
theme_args :
- oscar_style : logicodev-dark # default style of oscar
+ oscar_style : logicodev # default style of oscar
# searx supports result proxification using an external service: https://github.com/asciimoo/morty
# uncomment below section if you have running morty proxy