Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore(api): convert BaseQueueDispatcher from ABC to Protocol (#37200)
Eric Caof948e442e003
diff --git a/api/services/workflow/queue_dispatcher.py b/api/services/workflow/queue_dispatcher.pyindex 1a79958cc2d..0944b20357e 100644--- a/api/services/workflow/queue_dispatcher.py+++ b/api/services/workflow/queue_dispatcher.py@@ -1,13 +1,12 @@-from typing import override+from typing import Protocol, override"""Queue dispatcher system for async workflow execution.-Implements an ABC-based pattern for handling different subscription tiers+Implements a Protocol-based pattern for handling different subscription tierswith appropriate queue routing and priority assignment."""-from abc import ABC, abstractmethodfrom enum import StrEnumfrom configs import dify_config@@ -22,18 +21,16 @@ class QueuePriority(StrEnum):SANDBOX = "workflow_sandbox" # Free tier-class BaseQueueDispatcher(ABC):- """Abstract base class for queue dispatchers"""+class BaseQueueDispatcher(Protocol):+ """Protocol for queue dispatchers"""- @abstractmethoddef get_queue_name(self) -> str:"""Get the queue name for this dispatcher"""- pass+ ...- @abstractmethoddef get_priority(self) -> int:"""Get task priority level"""- pass+ ...class ProfessionalQueueDispatcher(BaseQueueDispatcher):diff --git a/api/tests/unit_tests/services/workflow/test_queue_dispatcher.py b/api/tests/unit_tests/services/workflow/test_queue_dispatcher.pyindex bbfc1cc294e..18b46e40f52 100644--- a/api/tests/unit_tests/services/workflow/test_queue_dispatcher.py+++ b/api/tests/unit_tests/services/workflow/test_queue_dispatcher.py@@ -1,9 +1,6 @@from unittest.mock import patch-import pytest-from services.workflow.queue_dispatcher import (- BaseQueueDispatcher,ProfessionalQueueDispatcher,QueueDispatcherManager,QueuePriority,@@ -35,10 +32,6 @@ class TestDispatchers:assert d.get_queue_name() == QueuePriority.SANDBOXassert d.get_priority() == 10- def test_base_dispatcher_is_abstract(self):- with pytest.raises(TypeError):- BaseQueueDispatcher()-class TestQueueDispatcherManager:@patch("services.workflow.queue_dispatcher.BillingService")