diff --git a/pyproject.toml b/pyproject.toml index 6739989..7e1de0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ dependencies = [ "httpx-oauth>=0.16.1,<0.17", "uvicorn[standard]>=0.34.0,<0.35", "temporalio>=1.10.0", + "uvloop>=0.21.0", ] [tool.hatch.build.targets.sdist] diff --git a/src/applications/temporal_worker/__main__.py b/src/applications/temporal_worker/__main__.py index 24d3970..a2563a0 100644 --- a/src/applications/temporal_worker/__main__.py +++ b/src/applications/temporal_worker/__main__.py @@ -1,4 +1,6 @@ -from asyncio import run +from asyncio import run, set_event_loop_policy + +import uvloop from core.temporal import get_client @@ -53,4 +55,7 @@ async def main(): await worker.run() +set_event_loop_policy(uvloop.EventLoopPolicy()) + + run(main()) diff --git a/uv.lock b/uv.lock index dc4a774..429599a 100644 --- a/uv.lock +++ b/uv.lock @@ -254,6 +254,7 @@ dependencies = [ { name = "temporalio" }, { name = "twitchapi" }, { name = "uvicorn", extra = ["standard"] }, + { name = "uvloop" }, ] [package.metadata] @@ -274,6 +275,7 @@ requires-dist = [ { name = "temporalio", specifier = ">=1.10.0" }, { name = "twitchapi", specifier = ">=4.4.0,<5" }, { name = "uvicorn", extras = ["standard"], specifier = ">=0.34.0,<0.35" }, + { name = "uvloop", specifier = ">=0.21.0" }, ] [[package]]