This commit is contained in:
2024-07-02 08:55:24 +03:00
parent 386ee7e460
commit 7ba3426989
18 changed files with 228 additions and 155 deletions

View File

@@ -1,9 +1,12 @@
import json
import asyncio
from asgiref.sync import async_to_sync
from background import celery
import background.update
@celery.task(name='test')
def test_task():
with open('test.json', 'a') as tf:
tf.write(json.dumps({'ok': True}))
@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))