Commit 444f494c authored by ibuler's avatar ibuler

[Update] 修改节点资产数量的bug

parent 3fdec62e
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment