Skip to content

Commit

Permalink
feat: gse 接口调用分片优化 (closed #2520)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 authored and wyyalt committed Dec 24, 2024
1 parent 4f86151 commit 2d566ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion apps/adapters/api/gse/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ def list_proc_state(
data_list_name="_host_info_list",
batch_call_func=concurrent.batch_call,
extend_result=False,
get_config_dict_func=lambda: {"limit": constants.QUERY_PROC_STATUS_HOST_LENS},
get_config_dict_func=lambda: {
"limit": models.GlobalSettings.get_config(
key=models.GlobalSettings.KeyEnum.QUERY_PROC_STATUS_HOST_LENS.value,
default=constants.QUERY_PROC_STATUS_HOST_LENS,
)
},
)
def get_proc_status_inner(
_namespace: str,
Expand Down
6 changes: 3 additions & 3 deletions apps/node_man/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class KeyEnum(Enum):
ADD_HOST_BIZ_BLACKLIST = "ADD_HOST_BIZ_BLACKLIST"
# CMDB内置云区域IDS
CMDB_INTERNAL_CLOUD_IDS = "CMDB_INTERNAL_CLOUD_IDS"
# GSE查询进程状态信息分片大小
QUERY_PROC_STATUS_HOST_LENS = "QUERY_PROC_STATUS_HOST_LENS"

key = models.CharField(_("键"), max_length=255, db_index=True, primary_key=True)
v_json = JSONField(_("值"))
Expand All @@ -193,9 +195,7 @@ def map_values(self, objs, source, target):

def fetch_isp(self):
isps = dict(GlobalSettings.objects.filter(key="isp").values_list("key", "v_json")).get("isp", [])
result = self.map_values(
isps, lambda isp: isp["isp"], lambda isp: {"isp_name": isp["isp_name"]}
)
result = self.map_values(isps, lambda isp: isp["isp"], lambda isp: {"isp_name": isp["isp_name"]})

return result

Expand Down

0 comments on commit 2d566ca

Please sign in to comment.