Skip to content

Commit

Permalink
🔧 Add timeouts to celery tasks
Browse files Browse the repository at this point in the history
Done in the context of issue maykinmedia/charts#148
  • Loading branch information
SilviaAmAm committed Jan 10, 2025
1 parent 2d1abfa commit 147de64
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/openklant/conf/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from open_api_framework.conf.base import * # noqa
from open_api_framework.conf.utils import config # noqa

from .api import * # noqa

Expand Down Expand Up @@ -50,3 +51,21 @@
"openklant.setup_configuration.steps.TokenAuthConfigurationStep",
"mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep",
)

#
# Celery
#

# Add (by default) 5 (soft), 15 (hard) minute timeouts to all Celery tasks.
CELERY_TASK_TIME_LIMIT = config(
"CELERY_TASK_HARD_TIME_LIMIT",
default=15 * 60,
help_text="Defaults to: ``900`` seconds. If a celery task exceeds this time limit, the worker processing the task will be killed and replaced with a new one.",
group="Celery",
) # hard
CELERY_TASK_SOFT_TIME_LIMIT = config(
"CELERY_TASK_SOFT_TIME_LIMIT",
default=5 * 60,
help_text="Defaults to: ``300`` seconds. If a celery task exceeds this time limit, the ``SoftTimeLimitExceeded`` exception will be raised.",
group="Celery",
) # soft

0 comments on commit 147de64

Please sign in to comment.