使用peewee-async查询数据好像并不是异步的,请老师指导一下
来源:7-6 通过peewee-async集成到tornado中

Philllll
2020-04-07
代码如下
cards = await db_session.execute(ScratchCard.select().where(ScratchCard.status == 1))
logging.info('S1')
ret = list()
await InitScratchCard.crontab(db_session)
logging.info('S2')
ts = int(time.time())
account_info = await AccountManager.get_account_info(account_id, db_session)
logging.info('S3')
account_economy = await AccountManager.get_account_economy(account_id, db_session)
logging.info('S4')
使用AB进行测试时,log是S1->S2->S3->S4,理论上异步应该是S1->S1->S1->S2->S2->·····
而且请求的时间基本上是并发数*单次请求的时间,不知道问题出在哪里
写回答
1回答
-
Philllll
提问者
2020-04-08
找出原因了,peewee_async.MySQLDatabase限制了最大连接数,改为PooledMySQLDatabase之后顺序正常。但是请求时间仍然是并发数*单次请求时间,与同步并没有什么区别。
112020-04-08
相似问题