mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-12 05:28:34 +03:00
adjusts limits for deployment performance
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user