diff options
| author | potato <mail@crazypotato.tk> | 2016-09-06 11:47:34 +0200 |
|---|---|---|
| committer | potato <mail@crazypotato.tk> | 2016-09-06 11:47:34 +0200 |
| commit | 9d08c81f47325ceea6d6ae1bda594fc8b8ee7764 (patch) | |
| tree | d7dba53107567f08c89ad12f24d5a10f986f5643 /searx/search.py | |
| parent | f4525880ed5f965ac4c241638933842a27a2acf7 (diff) | |
| parent | 55abf07a4f80f74fbcfbeddaee4f8591216802cd (diff) | |
Merge branch 'master' of https://github.com/asciimoo/searx
Diffstat (limited to 'searx/search.py')
| -rw-r--r-- | searx/search.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/search.py b/searx/search.py index 6de07d2b5..c6d17eba9 100644 --- a/searx/search.py +++ b/searx/search.py @@ -19,6 +19,7 @@ import gc import threading from thread import start_new_thread from time import time +from uuid import uuid4 import searx.poolrequests as requests_lib from searx.engines import ( categories, engines @@ -56,19 +57,20 @@ def search_request_wrapper(fn, url, engine_name, **kwargs): def threaded_requests(requests): timeout_limit = max(r[2]['timeout'] for r in requests) search_start = time() + search_id = uuid4().__str__() for fn, url, request_args, engine_name in requests: request_args['timeout'] = timeout_limit th = threading.Thread( target=search_request_wrapper, args=(fn, url, engine_name), kwargs=request_args, - name='search_request', + name=search_id, ) th._engine_name = engine_name th.start() for th in threading.enumerate(): - if th.name == 'search_request': + if th.name == search_id: remaining_time = max(0.0, timeout_limit - (time() - search_start)) th.join(remaining_time) if th.isAlive(): |