Selaa lähdekoodia

[enh] handle engine response crashes

Adam Tauber 8 vuotta sitten
vanhempi
commit
0205838f25
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  1. 5
    2
      searx/search.py

+ 5
- 2
searx/search.py Näytä tiedosto

@@ -118,7 +118,11 @@ def search_one_request(engine_name, query, request_params, result_container, tim
118 118
     if response:
119 119
         # parse the response
120 120
         response.search_params = request_params
121
-        search_results = engine.response(response)
121
+        try:
122
+            search_results = engine.response(response)
123
+        except:
124
+            logger.exception('engine crash: {0}'.format(engine.name))
125
+            search_results = []
122 126
 
123 127
         # add results
124 128
         for result in search_results:
@@ -135,7 +139,6 @@ def search_one_request(engine_name, query, request_params, result_container, tim
135 139
         engine.stats['engine_time'] += time() - request_params['started']
136 140
         engine.stats['engine_time_count'] += 1
137 141
 
138
-    #
139 142
     return success
140 143
 
141 144