feat: add task time limit settings, hard time limit

This commit is contained in:
Felix Spöttel
2023-06-28 09:44:27 +02:00
parent 78a38e6ec0
commit f323b06230
4 changed files with 17 additions and 6 deletions

View File

@@ -4,6 +4,9 @@ from app.shared.settings import settings
def get_celery_binding() -> Celery:
celery = Celery()
celery.conf.broker_url = settings.BROKER_URL
celery = Celery(
broker_url=settings.BROKER_URL,
broker_connection_retry=False,
broker_connection_retry_on_startup=False,
)
return celery

View File

@@ -8,6 +8,9 @@ class Settings(BaseSettings):
DATABASE_URI: str
ENVIRONMENT: str
TASK_SOFT_TIME_LIMIT: int = 3 * 60 * 60
TASK_HARD_TIME_LIMIT: int = 4 * 60 * 60
# derived settings
BROKER_URL: str
@@ -17,4 +20,4 @@ if "pytest" in sys.modules:
_env_file=".env.test", _env_file_encoding="utf-8"
) # type: ignore
else:
settings = Settings()
settings = Settings() # type: ignore