代码如下
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->·····
而且请求的时间基本上是并发数*单次请求的时间,不知道问题出在哪里