Update ensure_future/loop.create_task -> asyncio.create_task

This commit is contained in:
Tulir Asokan
2021-12-21 15:30:54 +02:00
parent 2615e11e34
commit f55d6606df
7 changed files with 14 additions and 16 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ class AuthAPI(abc.ABC):
existing_user = await User.get_by_tgid(user_info.id)
if existing_user and existing_user != user:
await existing_user.log_out()
asyncio.ensure_future(user.post_login(user_info, first_login=True), loop=self.loop)
asyncio.create_task(user.post_login(user_info, first_login=True))
if user.command_status and user.command_status["action"] == "Login":
user.command_status = None
@@ -212,9 +212,7 @@ class ProvisioningAPI(AuthAPI):
portal.photo_id = ""
await portal.save()
asyncio.ensure_future(
portal.update_matrix_room(user, entity, direct=False, levels=levels), loop=self.loop
)
asyncio.create_task(portal.update_matrix_room(user, entity, direct=False, levels=levels))
return web.Response(status=202, body="{}")
@@ -335,7 +333,7 @@ class ProvisioningAPI(AuthAPI):
self.log.exception("Failed to disconnect chat")
return self.get_error_response(500, "exception", "Failed to disconnect chat")
else:
asyncio.ensure_future(coro, loop=self.loop)
asyncio.create_task(coro)
return web.json_response({}, status=200 if sync else 202)
async def get_user_info(self, request: web.Request) -> web.Response: