V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  tire  ›  全部回复第 2 页 / 共 2 页
回复总数  25
1  2  
@hcymk2
之前是看了,但是印象肯定不深的,只能回去补,主要是不知道是哪个知识点的问题,刚才这个使用模块不知道跟我这个坑哪里有关联
什么意思,解释一下呗
@hcymk2
我在 save()之后调用 destroy_pool()方法的,就是销毁这个连接池 @hcymk2
async def test():
await orm.create_pool(loop=loop,host='localhost', port=3306,
user='www-data', password='www-data', database='awesome')
u = User(name='Test', email='[email protected]',
passwd='1234567890', image='about:blank')
await u.save()
await destroy_pool() #销毁连接池
orm.py 中定义的 destroy_pool()方法:
async def destroy_pool():
global __pool
if __pool is not None:
__pool.close()
await __pool.wait_closed()
@hcymk2
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2880 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 14:16 · PVG 22:16 · LAX 07:16 · JFK 10:16
Developed with CodeLauncher
♥ Do have faith in what you're doing.