From 6a98604fca67cb324dc4d737aeaf8165dfa997cf Mon Sep 17 00:00:00 2001 From: Mitry Date: Wed, 11 Dec 2024 19:59:58 -0300 Subject: [PATCH] fix worker aio loop --- storage-app/src/worker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage-app/src/worker.py b/storage-app/src/worker.py index 72ca3d6..632ee6d 100644 --- a/storage-app/src/worker.py +++ b/storage-app/src/worker.py @@ -1,7 +1,7 @@ from celery import Celery from shared.settings import BROKER_URL, RESULT_URL, CELERY_CONFIG from shared.worker_services import Zipper, Hasher, EmbeddingStatus -from asyncio import run +from asyncio import get_event_loop from typing import Optional, Any from json import JSONEncoder, loads, dumps from kombu.serialization import register @@ -29,7 +29,7 @@ def default(self, o) -> Any: return getattr(o, "__json__", super().default)(o) @worker.task(bind=True, name="produce_download_task") def produce_download_task(self, bucket_name: str, file_ids: list[str]) -> str | None: task = Zipper(bucket_name, file_ids, self) - run(task.archive_objects()) + get_event_loop().run_until_complete(task.archive_objects()) return task.archive_id