Eventlet timeout not exiting
问题 Why does eventlet allow it to finish the 6 seconds, when it should exit the indentation after 5 seconds? >>> with eventlet.Timeout(5): time.sleep(6) x = 1 >>> x 1 回答1: 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