Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix celery backend when use rabbitmq (#23238)

kenwoodjw1821726d4f4b
diff --git a/api/configs/middleware/__init__.py b/api/configs/middleware/__init__.py
index 68b16e48db7..ff290ff99d4 100644
--- a/api/configs/middleware/__init__.py
+++ b/api/configs/middleware/__init__.py
@@ -215,7 +215,7 @@ class DatabaseConfig(BaseSettings):
class CeleryConfig(DatabaseConfig):
CELERY_BACKEND: str = Field(
- description="Backend for Celery task results. Options: 'database', 'redis'.",
+ description="Backend for Celery task results. Options: 'database', 'redis', 'rabbitmq'.",
default="redis",
)
@@ -245,7 +245,12 @@ class CeleryConfig(DatabaseConfig):
@computed_field
def CELERY_RESULT_BACKEND(self) -> str | None:
- return f"db+{self.SQLALCHEMY_DATABASE_URI}" if self.CELERY_BACKEND == "database" else self.CELERY_BROKER_URL
+ if self.CELERY_BACKEND in ("database", "rabbitmq"):
+ return f"db+{self.SQLALCHEMY_DATABASE_URI}"
+ elif self.CELERY_BACKEND == "redis":
+ return self.CELERY_BROKER_URL
+ else:
+ return None
@property
def BROKER_USE_SSL(self) -> bool: