mirror of
https://github.com/MrSedan/neuro-reply-bot-reworked.git
synced 2026-01-14 21:49:42 +03:00
Use uvloop in linux
This commit is contained in:
4
main.py
4
main.py
@@ -57,9 +57,13 @@ if __name__ == '__main__':
|
|||||||
finally:
|
finally:
|
||||||
loop.close()
|
loop.close()
|
||||||
else:
|
else:
|
||||||
|
import uvloop
|
||||||
for signame in ('SIGINT', 'SIGTERM'):
|
for signame in ('SIGINT', 'SIGTERM'):
|
||||||
loop.add_signal_handler(getattr(signal, signame), loop.stop)
|
loop.add_signal_handler(getattr(signal, signame), loop.stop)
|
||||||
try:
|
try:
|
||||||
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
loop = uvloop.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
@@ -5,3 +5,4 @@ python-dateutil==2.8.2
|
|||||||
aiohttp==3.8.6
|
aiohttp==3.8.6
|
||||||
pydantic==2.3.0
|
pydantic==2.3.0
|
||||||
pydantic-settings==2.1.0
|
pydantic-settings==2.1.0
|
||||||
|
uvloop==0.19.0; sys.platform == 'linux'
|
||||||
Reference in New Issue
Block a user