return searxes
@retry(ExceptionToCheck=(ConnectionError, BrokenSearxError, RateLimitingError, json.JSONDecodeError, SSLError),
- tries=10, delay=1, backoff=1.1, logger=logger)
- def searx(self, text):
+ tries=10, delay=1, backoff=2, logger=logger)
+ def searx(self, text, retries=0):
if not self.search_list:
self.search_list = self.fetch_all_searx_engines()
raise
if not response.get('results', []):
- if response.get("unresponsive_engines", []):
- logger.debug("drop search engine, probably has issues: %s", self.search_list[0])
+ unresponsive_engines = response.get("unresponsive_engines", [])
+ if unresponsive_engines:
+ logger.warning("drop search engine, probably has issues: %s (engine issues: %s)", self.search_list[0], unresponsive_engines)
self.search_list.pop(0)
- return self.searx(text)
+ if retries < 3:
+ return self.searx(text, retries+1)
+ else:
+ logger.warning("Retries exceeded while iterating searx instances for a result")
+ return
logger.info("No results found, response: %s", response)
return