mirror of https://gitlab.com/litecord/litecord.git
guild.members: use context manager for pool conn acquire
This commit is contained in:
parent
e917982f6d
commit
bc3fa37d63
|
|
@ -95,8 +95,7 @@ async def _update_member_roles(guild_id: int, member_id: int, wanted_roles: set)
|
|||
# in wanted_roles
|
||||
removed_roles = roles - wanted_roles
|
||||
|
||||
conn = await app.db.acquire()
|
||||
|
||||
async with app.db.acquire() as conn:
|
||||
async with conn.transaction():
|
||||
# add roles
|
||||
await app.db.executemany(
|
||||
|
|
@ -119,8 +118,6 @@ async def _update_member_roles(guild_id: int, member_id: int, wanted_roles: set)
|
|||
[(member_id, guild_id, role_id) for role_id in removed_roles],
|
||||
)
|
||||
|
||||
await app.db.release(conn)
|
||||
|
||||
|
||||
@bp.route("/<int:guild_id>/members/<int:member_id>", methods=["PATCH"])
|
||||
async def modify_guild_member(guild_id, member_id):
|
||||
|
|
|
|||
Loading…
Reference in New Issue