diff options
author | Alexandre Flament <alex@al-f.net> | 2021-04-13 15:21:53 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-04-21 16:24:46 +0200 |
commit | aae7830d14242ac1f98232f428654c5d2c9c5eb2 (patch) | |
tree | 83df1950b7b5889fb17eda740a095022a816642e /searx/search/__init__.py | |
parent | ae5954f2dad0386868709a59a1b29d005ebb2b2d (diff) | |
download | searxng-aae7830d14242ac1f98232f428654c5d2c9c5eb2.tar.gz searxng-aae7830d14242ac1f98232f428654c5d2c9c5eb2.zip |
[mod] refactoring: processors
Report to the user suspended engines.
searx.search.processor.abstract:
* manages suspend time (per network).
* reports suspended time to the ResultContainer (method extend_container_if_suspended)
* adds the results to the ResultContainer (method extend_container)
* handles exceptions (method handle_exception)
Diffstat (limited to 'searx/search/__init__.py')
-rw-r--r-- | searx/search/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/search/__init__.py b/searx/search/__init__.py index f777e8595..5049d9ff7 100644 --- a/searx/search/__init__.py +++ b/searx/search/__init__.py @@ -106,12 +106,16 @@ class Search: for engineref in self.search_query.engineref_list: processor = processors[engineref.name] + # stop the request now if the engine is suspend + if processor.extend_container_if_suspended(self.result_container): + continue + # set default request parameters request_params = processor.get_params(self.search_query, engineref.category) if request_params is None: continue - with threading.RLock(): + with processor.lock: processor.engine.stats['sent_search_count'] += 1 # append request to list |