From 75d4cdb40bbff7f80a311e1890b9e7c3a04c2844 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 7 Dec 2023 09:56:05 +0100 Subject: [PATCH] sources/ldap: make sure lock is per-tenant Signed-off-by: Marc 'risson' Schmitt --- authentik/sources/ldap/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authentik/sources/ldap/models.py b/authentik/sources/ldap/models.py index 2b939e022..9c95c563d 100644 --- a/authentik/sources/ldap/models.py +++ b/authentik/sources/ldap/models.py @@ -7,7 +7,7 @@ from tempfile import NamedTemporaryFile, mkdtemp from typing import Optional from django.core.cache import cache -from django.db import models +from django.db import connection, models from django.utils.translation import gettext_lazy as _ from ldap3 import ALL, NONE, RANDOM, Connection, Server, ServerPool, Tls from ldap3.core.exceptions import LDAPException, LDAPInsufficientAccessRightsResult, LDAPSchemaError @@ -203,7 +203,7 @@ class LDAPSource(Source): """Redis lock for syncing LDAP to prevent multiple parallel syncs happening""" return Lock( cache.client.get_client(), - name=f"goauthentik.io/sources/ldap/sync-{self.slug}", + name=f"goauthentik.io/sources/ldap/sync{connection.schema_name}-{self.slug}", # Convert task timeout hours to seconds, and multiply times 3 # (see authentik/sources/ldap/tasks.py:54) # multiply by 3 to add even more leeway