adjusts limits for deployment performance

This commit is contained in:
msramalho
2026-03-02 15:04:38 +00:00
parent 01fa271415
commit 184d285d0e
5 changed files with 72 additions and 3 deletions

View File

@@ -21,6 +21,8 @@ def make_engine(database_url: str):
pool_size=15, # Increase pool size
max_overflow=20, # Allow more temporary connections
pool_recycle=1800, # Recycle connections every 30 minutes
pool_pre_ping=True, # Detect and replace stale connections
pool_timeout=30, # Timeout waiting for a connection from pool
)
@event.listens_for(engine, "connect")

View File

@@ -12,10 +12,13 @@ def get_celery(name: str = "") -> Celery:
name,
broker_url=get_settings().celery_broker_url,
result_backend=get_settings().celery_broker_url,
broker_connection_retry_on_startup=False,
broker_connection_retry_on_startup=True,
broker_transport_options={
"queue_order_strategy": "priority",
"visibility_timeout": 43200, # 12 hours - must be > longest task time_limit
},
result_expires=86400, # expire task results after 24 hours to prevent Redis memory buildup
worker_cancel_long_running_tasks_on_connection_loss=True,
)