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

art at torproject.org art at torproject.org
Tue Aug 27 10:03:52 UTC 2013


commit 23251cffeb0d23290206ad85ebc8e66f76e02945
Author: aagbsn <aagbsn at extc.org>
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()
 





More information about the tor-commits mailing list