Commit 458bbeea authored by Denis Bilenko's avatar Denis Bilenko

sleep optimization: only cancel the event in case of exception

parent be1f558e
......@@ -44,8 +44,9 @@ def sleep(seconds=0):
try:
switch_result = get_hub().switch()
assert switch_result is unique_mark, 'Invalid switch into sleep(): %r' % (switch_result, )
finally:
except:
t.cancel()
raise
def kill(greenlet, exception=GreenletExit):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment