summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2019-08-02 13:50:51 +0200
committerGitHub <noreply@github.com>2019-08-02 13:50:51 +0200
commit72029d27ded8d93ab891c616d6bffbe8d3a67dd2 (patch)
tree135388ae0dbd97abe3855745ba627c2ab181e975 /searx/webapp.py
parent2179079a9173b33b81e1084fc1e8e181c19ef8e9 (diff)
[enh] Add timeout limit per request (#1640)
The new url parameter "timeout_limit" set timeout limit defined in second. Example "timeout_limit=1.5" means the timeout limit is 1.5 seconds. In addition, the query can start with <[number] to set the timeout limit. For number between 0 and 99, the unit is the second : Example: "<30 searx" means the timeout limit is 3 seconds For number above 100, the unit is the millisecond: Example: "<850 searx" means the timeout is 850 milliseconds. In addition, there is a new optional setting: outgoing.max_request_timeout. If not set, the user timeout can't go above searx configuration (as before: the max timeout of selected engine for a query). If the value is set, the user can set a timeout between 0 and max_request_timeout using <[number] or timeout_limit query parameter. Related to #1077 Updated version of PR #1413 from @isj-privacore
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 8dd4af071..ffe9b4da9 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -628,7 +628,8 @@ def index():
fallback=settings['search']['language']),
base_url=get_base_url(),
theme=get_current_theme_name(),
- favicons=global_favicons[themes.index(get_current_theme_name())]
+ favicons=global_favicons[themes.index(get_current_theme_name())],
+ timeout_limit=request.form.get('timeout_limit', None)
)