Skip to content

Commit 6bd2d8a

Browse files
authored
fix(open api v2): cache use wrong (#2308)
1 parent c48279e commit 6bd2d8a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/bk-user/bkuser/apis/open_v2/mixins.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def get_data_source_ids(self) -> List[int]:
8484
).values_list("id", flat=True)
8585
)
8686

87+
@cachedmethod(timeout=60 * 60)
8788
def get_collaboration_field_mapping(self) -> Dict[Tuple[str, str], str]:
8889
"""
8990
默认租户的所有协同租户字段映射
@@ -109,4 +110,4 @@ def data_source_to_domain_map(self) -> Dict[Tuple[int, str], str]:
109110
}
110111

111112
def get_domain(self, data_source_id: int, target_tenant_id: str) -> str:
112-
return self.data_source_to_domain_map.get((data_source_id, target_tenant_id), "")
113+
return self.data_source_to_domain_map().get((data_source_id, target_tenant_id), "")

src/bk-user/bkuser/apis/open_v2/views/profilers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def _convert_domain_lookup_to_query(self, values: List[str], is_exact: bool) ->
401401
# 目标租户为默认租户的所有数据源 domain 映射
402402
domain_to_data_source_map = {
403403
domain: ds_id
404-
for (ds_id, tenant_id), domain in self.data_source_to_domain_map.items()
404+
for (ds_id, tenant_id), domain in self.data_source_to_domain_map().items()
405405
if tenant_id == self.default_tenant.id
406406
}
407407

0 commit comments

Comments
 (0)