Skip to content

Commit

Permalink
sources/ldap: fix task timeout for ldap_sync_all and ldap_sync_single…
Browse files Browse the repository at this point in the history
… (#6809)

* sources/ldap: fix task timeout for ldap_sync_all and ldap_sync_single

* ldap_sync_all runs tasks async so doesn't need longer timeouts

Signed-off-by: Jens Langhammer <[email protected]>

* bump time more as we run some tasks in serial and add more leeway

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: Jens Langhammer <[email protected]>
  • Loading branch information
a-gerhard and BeryJu authored Sep 8, 2023
1 parent 619927a commit 06850a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion authentik/sources/ldap/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 06850a2

Please sign in to comment.