Files
dify/api/schedule/trigger_provider_refresh_task.py
非法操作andautofix-ci[bot] ce26b22970 refactor(api): isolate trigger execution lifecycle (#45950)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-11-10 08:17:39 +00:00

17 lines
715 B
Python

from celery import shared_task
from configs import dify_config
from extensions.ext_application_services import application_services
from libs.helper import current_timestamp
@shared_task(queue="trigger_refresh_publisher")
def trigger_provider_refresh() -> None:
"""Scan due subscriptions in bounded batches and enqueue independently reserved jobs."""
application_services().triggers.subscription_refresh.enqueue_due(
now=current_timestamp(),
credential_threshold=dify_config.TRIGGER_PROVIDER_CREDENTIAL_THRESHOLD_SECONDS,
subscription_threshold=dify_config.TRIGGER_PROVIDER_SUBSCRIPTION_THRESHOLD_SECONDS,
batch_size=dify_config.TRIGGER_PROVIDER_REFRESH_BATCH_SIZE,
)