How i call async function without await?

前端 未结 2 1950
Happy的楠姐
Happy的楠姐 2021-01-01 19:08

I have a controller action in aiohttp application.

async def handler_message(request):

    try:
        content = await request.json()
        perform_messa         


        
2条回答
  •  -上瘾入骨i
    2021-01-01 19:18

    Other way would be to use ensure_future function:

    import asyncio
    
    async def handler_message(request):
    ...
    loop = asyncio.get_event_loop()
    loop.ensure_future(perform_message(x,y,z))
    ...
    

提交回复
热议问题