diff --git a/authentik/sources/ldap/tasks.py b/authentik/sources/ldap/tasks.py index 39aeb4c3c..0223a68ba 100644 --- a/authentik/sources/ldap/tasks.py +++ b/authentik/sources/ldap/tasks.py @@ -33,7 +33,13 @@ def ldap_sync_all(): ldap_sync_single(source.pk) -@CELERY_APP.task() +@CELERY_APP.task( + # We take the configured hours timeout time by 2.5 as we run user and + # group in parallel and then membership, so 2x is to cover the serial tasks, + # and 0.5x on top of that to give some more leeway + soft_time_limit=(60 * 60 * CONFIG.get_int("ldap.task_timeout_hours")) * 2.5, + task_time_limit=(60 * 60 * CONFIG.get_int("ldap.task_timeout_hours")) * 2.5, +) def ldap_sync_single(source_pk: str): """Sync a single source""" source: LDAPSource = LDAPSource.objects.filter(pk=source_pk).first()