mirror of
https://github.com/hibobmaster/matrix_chatgpt_bot.git
synced 2024-09-30 09:05:40 +00:00
prefer asyncio.get_event_loop instead of asyncio.new_event_loop
This commit is contained in:
parent
fe1a53780d
commit
c87a4d3476
6
main.py
6
main.py
@ -20,9 +20,9 @@ async def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
asyncio.run(main())
|
||||
loop = asyncio.get_event_loop()
|
||||
task = loop.create_task(main())
|
||||
loop.run_until_complete(task)
|
||||
except KeyboardInterrupt:
|
||||
loop.close()
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user