1
目前我没有异步代码。我的龙卷风成本看起来像有没有简单的方法从同步到异步方式从Tornado中的数据库获取结果?
class EmployeeHandler(tornado.web.RequestHandler):
'''Returns all users which satisfy conditions'''
def post(self):
data = tornado.escape.json_decode(self.request.body)
age = data['age']
education = data['education']
result = self._filter(education, age)
self.write(json.dumps(result))
self.flush()
def _filter(self, education, age):
'''Reads from local database a lot using SQLAlchemy, make joins and is slow'''
pass
有没有简单的方法来使这个异步,来从过滤后的结果异步?
相关问题:http://stackoverflow.com/questions/10214042/can-sqlalchemy-be-configured-to-be-non-blocking – stalk 2013-05-07 13:31:55