Kaynağa Gözat

change unresponsive_engines to a set to eliminate duplication of errors

Noémi Ványi 7 yıl önce
ebeveyn
işleme
2242000bd4
2 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 3
    3
      searx/results.py
  2. 1
    1
      tests/unit/test_webapp.py

+ 3
- 3
searx/results.py Dosyayı Görüntüle

@@ -135,7 +135,7 @@ class ResultContainer(object):
135 135
         self._number_of_results = []
136 136
         self._ordered = False
137 137
         self.paging = False
138
-        self.unresponsive_engines = []
138
+        self.unresponsive_engines = set()
139 139
 
140 140
     def extend(self, engine_name, results):
141 141
         for result in list(results):
@@ -306,5 +306,5 @@ class ResultContainer(object):
306 306
             return 0
307 307
         return resultnum_sum / len(self._number_of_results)
308 308
 
309
-    def add_unresponsive_engine(self, engine_name):
310
-        self.unresponsive_engines.append(engine_name)
309
+    def add_unresponsive_engine(self, engine_error):
310
+        self.unresponsive_engines.add(engine_error)

+ 1
- 1
tests/unit/test_webapp.py Dosyayı Görüntüle

@@ -39,7 +39,7 @@ class ViewsTestCase(SearxTestCase):
39 39
                                                 corrections=set(),
40 40
                                                 suggestions=set(),
41 41
                                                 infoboxes=[],
42
-                                                unresponsive_engines=[],
42
+                                                unresponsive_engines=set(),
43 43
                                                 results=self.test_results,
44 44
                                                 results_number=lambda: 3,
45 45
                                                 results_length=lambda: len(self.test_results))