Browse Source

[mod] display timeoutted engine name

Adam Tauber 10 years ago
parent
commit
2b7f3e28e7
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      searx/search.py

+ 4
- 3
searx/search.py View File

@@ -37,7 +37,7 @@ number_of_searches = 0
37 37
 def threaded_requests(requests):
38 38
     timeout_limit = max(r[2]['timeout'] for r in requests)
39 39
     search_start = time()
40
-    for fn, url, request_args in requests:
40
+    for fn, url, request_args, engine_name in requests:
41 41
         request_args['timeout'] = timeout_limit
42 42
         th = threading.Thread(
43 43
             target=fn,
@@ -45,6 +45,7 @@ def threaded_requests(requests):
45 45
             kwargs=request_args,
46 46
             name='search_request',
47 47
         )
48
+        th._engine_name = engine_name
48 49
         th.start()
49 50
 
50 51
     for th in threading.enumerate():
@@ -52,7 +53,7 @@ def threaded_requests(requests):
52 53
             remaining_time = max(0.0, timeout_limit - (time() - search_start))
53 54
             th.join(remaining_time)
54 55
             if th.isAlive():
55
-                print('engine timeout')
56
+                print('engine timeout: {0}'.format(th._engine_name))
56 57
 
57 58
 
58 59
 
@@ -481,7 +482,7 @@ class Search(object):
481 482
                 continue
482 483
 
483 484
             # append request to list
484
-            requests.append((req, request_params['url'], request_args))
485
+            requests.append((req, request_params['url'], request_args, selected_engine['name']))
485 486
 
486 487
         # send all search-request
487 488
         threaded_requests(requests)