🐛 fix(celery_app.py): add return type annotation to make_celery function to improve code readability and maintainability
🔧 chore(celeryconfig.py): update broker_url default value to use RabbitMQ instead of Redis for better performance and scalability
This commit is contained in:
parent
8c7df5e2f7
commit
befe79775b
2 changed files with 3 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from celery import Celery # type: ignore
|
||||
|
||||
|
||||
def make_celery(app_name: str, config: str):
|
||||
def make_celery(app_name: str, config: str) -> Celery:
|
||||
celery_app = Celery(app_name)
|
||||
celery_app.config_from_object(config)
|
||||
celery_app.conf.task_routes = {"langflow.worker.tasks.*": {"queue": "langflow"}}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import os
|
|||
langflow_redis_host = os.environ.get("LANGFLOW_REDIS_HOST")
|
||||
langflow_redis_port = os.environ.get("LANGFLOW_REDIS_PORT")
|
||||
if "BROKER_URL" in os.environ and "RESULT_BACKEND" in os.environ:
|
||||
broker_url = os.environ.get("BROKER_URL", "redis://localhost:6379/0")
|
||||
# RabbitMQ
|
||||
broker_url = os.environ.get("BROKER_URL", "amqp://localhost")
|
||||
result_backend = os.environ.get("RESULT_BACKEND", "redis://localhost:6379/0")
|
||||
elif langflow_redis_host and langflow_redis_port:
|
||||
broker_url = f"redis://{langflow_redis_host}:{langflow_redis_port}/0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue