[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Track the number of failures, not the instances.



commit 23251cffeb0d23290206ad85ebc8e66f76e02945
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Sun Aug 25 14:59:35 2013 +0200

    Track the number of failures, not the instances.
    
    The number of failures on very large scans (1m hosts) results in
    a large list. This commit tracks the number of failures instead
    of the objects.
---
 ooni/managers.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ooni/managers.py b/ooni/managers.py
index 36b791e..a229044 100644
--- a/ooni/managers.py
+++ b/ooni/managers.py
@@ -22,7 +22,7 @@ class TaskManager(object):
     def __init__(self):
         self._tasks = iter(())
         self._active_tasks = []
-        self.failures = []
+        self.failures = 0
 
     def _failed(self, failure, task):
         """
@@ -33,7 +33,7 @@ class TaskManager(object):
         log.exception(failure)
 
         self._active_tasks.remove(task)
-        self.failures.append((failure, task))
+        self.failures = self.failures + 1
 
         if task.failures <= self.retries:
             log.debug("Rescheduling...")
@@ -85,7 +85,7 @@ class TaskManager(object):
 
     @property
     def failedMeasurements(self):
-        return len(self.failures)
+        return self.failures
 
     @property
     def availableSlots(self):
@@ -110,7 +110,7 @@ class TaskManager(object):
         """
         This is called to start the task manager.
         """
-        self.failures = []
+        self.failures = 0
 
         self._fillSlots()
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits