[tor-commits] [ooni-probe/master] Cancel tasks on timeout
isis at torproject.org
isis at torproject.org
Sun Mar 10 01:57:02 UTC 2013
commit 8a63d6d03cb2d50f45d63a8bf6023c19f66a02c5
Author: aagbsn <aagbsn at extc.org>
Date: Fri Feb 15 17:53:55 2013 +0100
Cancel tasks on timeout
Deferred.cancel() swallows AlreadyCalled exceptions.
---
ooni/tasks.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ooni/tasks.py b/ooni/tasks.py
index a73ce11..c17a5c1 100644
--- a/ooni/tasks.py
+++ b/ooni/tasks.py
@@ -62,13 +62,15 @@ class TaskTimedOut(Exception):
pass
class TaskWithTimeout(BaseTask):
- timeout = 5
+ timeout = 30
# So that we can test the callLater calls
clock = reactor
def _timedOut(self):
"""Internal method for handling timeout failure"""
- self._running.errback(TaskTimedOut)
+ if not self._running.called:
+ self._running.cancel()
+ self._failed(TaskTimedOut)
def _cancelTimer(self):
#import pdb; pdb.set_trace()
More information about the tor-commits
mailing list