fix celery config

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
pull/22566/head
kenwoodjw 10 months ago
parent a4ef900916
commit 21d55c7c61

@ -54,7 +54,7 @@ REDIS_CLUSTERS_PASSWORD=
# celery configuration # celery configuration
CELERY_BROKER_URL=redis://:difyai123456@localhost:${REDIS_PORT}/1 CELERY_BROKER_URL=redis://:difyai123456@localhost:${REDIS_PORT}/1
CELERY_BACKEND=redis
# PostgreSQL database configuration # PostgreSQL database configuration
DB_USERNAME=postgres DB_USERNAME=postgres
DB_PASSWORD=difyai123456 DB_PASSWORD=difyai123456

@ -209,9 +209,10 @@ class DatabaseConfig(BaseSettings):
class CeleryConfig(DatabaseConfig): class CeleryConfig(DatabaseConfig):
CELERY_BACKEND: str = Field( CELERY_BACKEND: str = Field(
description="Backend for Celery task results. Options: 'database', 'redis'.", description="Backend for Celery task results. Options: 'database', 'redis'.",
default="database", default="redis",
) )
CELERY_BROKER_URL: Optional[str] = Field( CELERY_BROKER_URL: Optional[str] = Field(
@ -240,6 +241,7 @@ class CeleryConfig(DatabaseConfig):
@computed_field @computed_field
def CELERY_RESULT_BACKEND(self) -> str | None: def CELERY_RESULT_BACKEND(self) -> str | None:
return ( return (
"db+{}".format(self.SQLALCHEMY_DATABASE_URI) "db+{}".format(self.SQLALCHEMY_DATABASE_URI)
if self.CELERY_BACKEND == "database" if self.CELERY_BACKEND == "database"

Loading…
Cancel
Save