import asyncio from asgiref.sync import async_to_sync from background import celery import background.update @celery.task(name='process_update') def process_update(product_ids: list[int]): loop = asyncio.get_event_loop() return loop.run_until_complete(background.update.process_update(product_ids))