Corp/backend/notifications/tasks/push_control.py

26 lines
616 B
Python

"""Celery entry point for invisible browser-notification commands."""
from celery import shared_task
@shared_task(
name="notifications.send_push_control",
autoretry_for=(Exception,),
retry_backoff=True,
max_retries=2,
)
def send_push_control(
user_id: int,
action: str,
scope: dict,
replacement_notification_id: int | None = None,
):
from notifications.senders.push_control import PushControlSender
return PushControlSender().send(
user_id=user_id,
action=action,
scope=scope,
replacement_notification_id=replacement_notification_id,
)