diff --git a/apps/assets/models/node.py b/apps/assets/models/node.py index da8563cc1..37ebbd6d3 100644 --- a/apps/assets/models/node.py +++ b/apps/assets/models/node.py @@ -39,9 +39,9 @@ class TreeMixin: tree_updated_time = cache.get(cls.tree_updated_time_cache_key, 0) if not cls.tree_created_time or \ tree_updated_time > cls.tree_created_time: + logger.debug("Create node tree") tree = TreeService.new() cls.tree_created_time = time.time() - cls.refresh_tree(cls.tree_assets_created_time) cls.tree_assets_created_time = time.time() cls._tree_service = tree return tree @@ -50,7 +50,7 @@ class TreeMixin: node_assets_updated_time > cls.tree_assets_created_time: cls._tree_service.init_assets_async() cls.tree_assets_created_time = time.time() - cls.refresh_node_assets(cls.tree_assets_created_time) + logger.debug("Refresh node tree assets") return cls._tree_service @classmethod diff --git a/apps/assets/utils.py b/apps/assets/utils.py index 16eb28ec8..01dae25be 100644 --- a/apps/assets/utils.py +++ b/apps/assets/utils.py @@ -92,6 +92,8 @@ class TreeService(Tree): def init_assets(self): from orgs.utils import tmp_to_root_org self.all_nodes_assets_map = {} + self.nodes_assets_map = defaultdict(set) + logger.debug('Init tree assets') with tmp_to_root_org(): queryset = Asset.objects.all().values_list('id', 'nodes__key') for asset_id, key in queryset: