You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
467 B

from celery_once import QueueOnce
from aggregator.client import get_client
from config.celery import app
from .client import collect_new_messages as _collect_new_messages
@app.task(base=QueueOnce, once={'keys': ['chat_id'], 'graceful': True})
def collect_new_messages(chat_id):
from .models import Chat
chat = Chat.objects.get(pk=chat_id)
client = get_client(takeout=True)
_collect_new_messages(client, chat)