在loop.create_task()上延迟调用的异步函数

时间:2019-08-24 11:09:10

标签: python-3.6 python-asyncio

因此,我正在创建一个Discord机器人,该机器人必须将每条消息都连接到Websocket,以更新表/编辑Discord上的消息。问题是更新延迟太久了,我不知道是什么原因导致该问题,而在python上的asyncio经验不足

loop = asyncio.get_event_loop()

#... some code ...

def on_message(self, message):
   # Receives the data from the websocket

   loop.create_task(UpdateTable(message))

#this one gots called delayed w/c is the problem
async def UpdateTable(newOutput):
   # Do some shit
   await discordMessage.edit(content=newOutput)


可能是什么原因造成的?

0 个答案:

没有答案