I have a problem with one my async tests: tornado seems not to be up and running (I get 599s), even though it is started as a fixture. I would like to verify that it is indeed running, by doing the following:
How can I tell python to sleep without blocking the async loop? If I do time.sleep
, the whole process (and thus the loop) is not responsive for the duration of the sleep.
Both of your questions are answered in Tornado's FAQ:
http://www.tornadoweb.org/en/latest/faq.html
Use yield gen.sleep(1)
to wait 1 second while letting other tasks run on the event loop, or use IOLoop.current().add_timeout(1, callback)
to run a callback one second later.
Don't use your browser to verify that your application handles multiple requests concurrently: the browser itself may not allow concurrent requests. Use curl
instead.