[tor-commits] [ooni-probe/master] Track the number of failed reporters

art at torproject.org art at torproject.org
Tue Aug 27 09:21:51 UTC 2013


commit 0d4243c1ff29d0e6392413f05bc2c01a29f6b60b
Author: aagbsn <aagbsn at extc.org>
Date:   Sun Aug 25 13:23:20 2013 +0200

    Track the number of failed reporters
---
 ooni/reporter.py |    1 +
 ooni/tasks.py    |    6 ++----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/ooni/reporter.py b/ooni/reporter.py
index aee96e5..b5fcce8 100644
--- a/ooni/reporter.py
+++ b/ooni/reporter.py
@@ -456,6 +456,7 @@ class Report(object):
             def report_failed(failure):
                 log.debug("Report Write Failure")
                 try:
+                    report_tracker.failedReporters.append(reporter)
                     self.failedWritingReport(failure, reporter)
                 except errors.NoMoreReporters, e:
                     log.err("No More Reporters!")
diff --git a/ooni/tasks.py b/ooni/tasks.py
index ba7ea4e..baefb51 100644
--- a/ooni/tasks.py
+++ b/ooni/tasks.py
@@ -133,6 +133,7 @@ class ReportTracker(object):
     def __init__(self, reporters):
         self.report_completed = 0
         self.reporters = reporters
+        self.failedReporters = []
 
     def finished(self):
         """
@@ -142,10 +143,7 @@ class ReportTracker(object):
         # is considered completed but failed, but the number
         # of reporters is now decreased by the number of failed
         # reporters.
-        # XXX: should we track to see if, for example:
-        # self.report_completed == len(self.reporters) + \
-        #        len(self.failed_reporters)
-        if self.report_completed >= len(self.reporters):
+        if self.report_completed == (len(self.reporters) + len(self.failedReporters)):
             return True
         return False
 





More information about the tor-commits mailing list