commit 0791b2dd50507bdf448c239a4b39b05bd8fddcd4 Author: aagbsn aagbsn@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()
tor-commits@lists.torproject.org