Skip to content

Commit

Permalink
fix(worker): add shutdown_event to worker handler per TaskIQ v0.11.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Nov 24, 2024
1 parent ee68a4b commit 1eb8268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"eth-pydantic-types", # Use same version as eth-ape
"packaging", # Use same version as eth-ape
"pydantic_settings", # Use same version as eth-ape
"taskiq[metrics]>=0.11.3,<0.12",
"taskiq[metrics]>=0.11.9,<0.12",
"tomlkit>=0.12,<1", # For reading/writing global platform profile
"fief-client[cli]>=0.19,<1", # for platform auth/cluster login
],
Expand Down
3 changes: 2 additions & 1 deletion silverback/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


async def run_worker(broker: AsyncBroker, worker_count=2, shutdown_timeout=90):
shutdown_event = asyncio.Event()
try:
tasks = []
with ThreadPoolExecutor(max_workers=worker_count) as pool:
Expand All @@ -19,7 +20,7 @@ async def run_worker(broker: AsyncBroker, worker_count=2, shutdown_timeout=90):
max_prefetch=0,
)
broker.is_worker_process = True
tasks.append(receiver.listen())
tasks.append(receiver.listen(shutdown_event))

await asyncio.gather(*tasks)
finally:
Expand Down

0 comments on commit 1eb8268

Please sign in to comment.