= get(url)
time.sleep(5)
print("synchronous_fetch")
return response.text
# 简单的模拟异步操作,这里之后应该替换成各种异步库的函数...,但是是无序的,要是需要返回结果的话解析起来比较麻烦
print("end request:", body)
# print(type(body), len(body),...,会阻塞的非常严重,比如synchronous_geter
2.flask+celery可以完成常见的异步任务
3.await语法只能出现在通过async修饰的函数中
4.可以看到tornado.gen.coroutine...,以及6.0版本的中文文档,适合英语不好的人阅读
https://www.osgeo.cn/tornado/releases/v5.0.0.html# 在Python 3上, IOLoop 总是包装asyncio...这是我重新复习tornado的原因,tornado放弃了之前自己实现的tornado.ioloop,全面拥抱asyncio的event_loop.这个改动是非常大的,
而且阅读tornado的源码可以发现其中大部分函数都支持了类型检验