From 2242000bd4e9491e9f8d15568b4387540096a982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 19 Jul 2017 17:23:54 +0200 Subject: [PATCH] change unresponsive_engines to a set to eliminate duplication of errors --- searx/results.py | 6 +++--- tests/unit/test_webapp.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/searx/results.py b/searx/results.py index a7b2e385..badd86dd 100644 --- a/searx/results.py +++ b/searx/results.py @@ -135,7 +135,7 @@ class ResultContainer(object): self._number_of_results = [] self._ordered = False self.paging = False - self.unresponsive_engines = [] + self.unresponsive_engines = set() def extend(self, engine_name, results): for result in list(results): @@ -306,5 +306,5 @@ class ResultContainer(object): return 0 return resultnum_sum / len(self._number_of_results) - def add_unresponsive_engine(self, engine_name): - self.unresponsive_engines.append(engine_name) + def add_unresponsive_engine(self, engine_error): + self.unresponsive_engines.add(engine_error) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 74fbea51..e6739bfe 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -39,7 +39,7 @@ class ViewsTestCase(SearxTestCase): corrections=set(), suggestions=set(), infoboxes=[], - unresponsive_engines=[], + unresponsive_engines=set(), results=self.test_results, results_number=lambda: 3, results_length=lambda: len(self.test_results))