feat: init commint
This commit is contained in:
@@ -14,6 +14,34 @@ def execute_ticket_draft_analysis(draft_id: int, run_id: int) -> None:
|
||||
execute_draft_analysis(draft_id, run_id)
|
||||
|
||||
|
||||
@shared_task(name="apps.tickets.tasks.advance_ticket_automation")
|
||||
def advance_ticket_automation_task(run_id: int) -> None:
|
||||
from apps.tickets.automation import advance_ticket_automation
|
||||
|
||||
advance_ticket_automation(run_id)
|
||||
|
||||
|
||||
@shared_task(name="apps.tickets.tasks.close_ticket_automation")
|
||||
def close_ticket_automation_task(run_id: int) -> bool:
|
||||
from apps.tickets.automation import close_due_ticket_automation
|
||||
|
||||
return close_due_ticket_automation(run_id)
|
||||
|
||||
|
||||
@shared_task(name="apps.tickets.tasks.close_due_ticket_automations")
|
||||
def close_due_ticket_automations_task() -> int:
|
||||
from apps.tickets.automation import close_due_ticket_automation
|
||||
from apps.tickets.models import TicketAutomationRun
|
||||
|
||||
run_ids = list(
|
||||
TicketAutomationRun.objects.filter(
|
||||
status="waiting_customer",
|
||||
next_action_at__lte=timezone.now(),
|
||||
).values_list("id", flat=True)[:500]
|
||||
)
|
||||
return sum(bool(close_due_ticket_automation(run_id)) for run_id in run_ids)
|
||||
|
||||
|
||||
@shared_task(name="apps.tickets.tasks.cleanup_expired_ticket_drafts")
|
||||
def cleanup_expired_ticket_drafts() -> int:
|
||||
queryset = TicketDraft.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user