diff --git a/main.py b/main.py index 6b5573d..4cd2b2d 100644 --- a/main.py +++ b/main.py @@ -57,9 +57,13 @@ if __name__ == '__main__': finally: loop.close() else: + import uvloop for signame in ('SIGINT', 'SIGTERM'): loop.add_signal_handler(getattr(signal, signame), loop.stop) try: + asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) + loop = uvloop.new_event_loop() + asyncio.set_event_loop(loop) asyncio.run(main()) except KeyboardInterrupt: pass \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 87ec6ba..a1d1092 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ requests==2.31.0 python-dateutil==2.8.2 aiohttp==3.8.6 pydantic==2.3.0 -pydantic-settings==2.1.0 \ No newline at end of file +pydantic-settings==2.1.0 +uvloop==0.19.0; sys.platform == 'linux' \ No newline at end of file