Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't forget about a Timer when it is set with a Timeout...

  • Loading branch information...
commit 604dc1c6b4f2837e92c1c55e9979a5c7ae62cf19 1 parent d8bfd55
Alvaro authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 evy/timeout.py
View
9 evy/timeout.py
@@ -71,10 +71,13 @@ def start (self):
else:
hub = get_hub()
if self.exception is None or isinstance(self.exception, bool): # timeout that raises self
- self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, self)
+ exc = self
else: # regular timeout with user-provided exception
- self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, self.exception)
- self.timer.forget()
+ exc = self.exception
+
+ self.timer = hub.schedule_call_global(self.seconds, greenlet.getcurrent().throw, exc)
+
+ ## TODO: breaks some tests, but maybe we should call self.timer.forget()...
return self
Please sign in to comment.
Something went wrong with that request. Please try again.