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.
You may check your code whether your request method is POST
or PUT
, I get the 599
Response Code when I use method POST
and didn't post a data, and it gones when I added data
.
error:
res = self.fetch('/', method='POST')
fixed:
res = self.fetch('/', method='POST', data={})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.