sources/ldap: fix task timeout for ldap_sync_all and ldap_sync_single (#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 <jens@goauthentik.io> * bump time more as we run some tasks in serial and add more leeway Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
619927a7d4
commit
06850a2f57
|
@ -33,7 +33,13 @@ def ldap_sync_all():
|
||||||
ldap_sync_single(source.pk)
|
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):
|
def ldap_sync_single(source_pk: str):
|
||||||
"""Sync a single source"""
|
"""Sync a single source"""
|
||||||
source: LDAPSource = LDAPSource.objects.filter(pk=source_pk).first()
|
source: LDAPSource = LDAPSource.objects.filter(pk=source_pk).first()
|
||||||
|
|
Reference in New Issue