diff --git a/g3w-admin/core/utils/decorators.py b/g3w-admin/core/utils/decorators.py index 7dd45654a..9cea68758 100644 --- a/g3w-admin/core/utils/decorators.py +++ b/g3w-admin/core/utils/decorators.py @@ -10,6 +10,10 @@ from guardian.exceptions import GuardianError from guardian.utils import get_40x_or_None +import logging + +logger = logging.getLogger('g3wadmin.debug') + def project_type_permission_required(perm, lookup_variables=None, **kwargs): """ @@ -155,6 +159,7 @@ def _decorator(view_func): @wraps(view_func) def _wrapped_view(request, *args, **kwargs): key = f"{key_prefix}{'_'.join([str(kwargs[k]) for k in key_args] + [str(request.user.pk)])}" + logger.debug(f"[CACHING /api/config]: Key {key}") response = cache.get(key) if not response: response = view_func(request, *args, **kwargs) diff --git a/g3w-admin/qdjango/models/projects.py b/g3w-admin/qdjango/models/projects.py index a115afbc5..f3a988202 100644 --- a/g3w-admin/qdjango/models/projects.py +++ b/g3w-admin/qdjango/models/projects.py @@ -33,7 +33,7 @@ setPermissionUserObject, ) -logger = logging.getLogger(__name__) +logger = logging.getLogger('g3wadmin.debug') # Layer type with widget set capability TYPE_LAYER_FOR_WIDGET = ("postgres", "spatialite", "ogr", "mssql", "virtual", "oracle") @@ -523,16 +523,24 @@ def invalidate_cache(self, user=None): """Method to invalidate(delete) API REST /api/config""" # invalidate project cache - pre_key = f"{settings.QDJANGO_PRJ_CACHE_KEY}{self.group.pk}_{'qdjango'}_{self.pk}" + pre_key = ( + f"{settings.QDJANGO_PRJ_CACHE_KEY}{self.group.pk}_{'qdjango'}_{self.pk}" + ) if user == None: # Invalidate every cache for every user users = User.objects.all() for user in users: + logger.debug( + f"[CACHING /api/config]: Ivalidate key {pre_key}_{str(user.pk)}" + ) cache.delete(f"{pre_key}_{str(user.pk)}") else: # Invalidate only for user + logger.debug( + f"[CACHING /api/config]: Ivalidate key {pre_key}_{str(user.pk)}" + ) cache.delete(f"{pre_key}_{str(user.pk)}")