Eventlet provides cooperative multithreading. Which means you need to yield control to give hub or coroutines (in this case, hub implements timeouts) chance to run. To yield control:
either use green versions of IO and sleep
or execute eventlet.monkey_patch(), now you can use regular time, socket, etc modules, replaced by "green" versions, cooperating with Eventlet.
Any CPU tight code without green calls, for example [_ for _ in xrange(1000000000)] is impossible to interrupt at all. If you find yourself in similar situation, place eventlet.sleep(0) somewhere in loop, that would enter Eventlet hub and allow timeouts to work.
Eventlet provides cooperative multithreading. Which means you need to yield control to give hub or coroutines (in this case, hub implements timeouts) chance to run. To yield control:
eventlet.monkey_patch()
, now you can use regulartime
,socket
, etc modules, replaced by "green" versions, cooperating with Eventlet.Any CPU tight code without green calls, for example
[_ for _ in xrange(1000000000)]
is impossible to interrupt at all. If you find yourself in similar situation, placeeventlet.sleep(0)
somewhere in loop, that would enter Eventlet hub and allow timeouts to work.