oncall-engine/engine/apps/alerts/tasks/custom_webhook_result.py
Matias Bordese 2a89374adf
Add escalation chain support for new webhooks (#1654)
Allow setting a webhook as escalation chain policy step.
2023-04-05 12:03:55 +00:00

16 lines
520 B
Python

import logging
from django.conf import settings
from common.custom_celery_tasks import shared_dedicated_queue_retry_task
logger = logging.getLogger(__name__)
@shared_dedicated_queue_retry_task(
autoretry_for=(Exception,), retry_backoff=True, max_retries=1 if settings.DEBUG else None
)
def custom_webhook_result(webhook_pk, alert_group_pk, escalation_policy_pk=None):
from apps.webhooks.tasks import execute_webhook
execute_webhook.apply_async((webhook_pk, alert_group_pk, None, escalation_policy_pk))