Skip to content

Commit

Permalink
feat: 超大订阅方案 (closed #2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Nov 11, 2024
1 parent 24a4df8 commit bf9b5e8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions apps/backend/subscription/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,21 +1050,21 @@ def get_instances_by_scope(
bk_biz_id, scope, instances, data_backend
)

instances_dict: typing.Union[RedisDict, dict] = DynamicContainer(data_backend=data_backend).container
data = {
"object_type": scope["object_type"],
"node_type": models.Subscription.NodeType.INSTANCE,
}
instances_dict: typing.Union[RedisDict, dict] = DynamicContainer(data_backend=data_backend).container
data = {
"object_type": scope["object_type"],
"node_type": models.Subscription.NodeType.INSTANCE,
}

bk_host_ids = []
bk_host_ids = []

for instance in instances:
is_host = data["object_type"] == models.Subscription.ObjectType.HOST
instance_data = instance["host"] if is_host else instance["service"]
for instance in instances:
is_host = data["object_type"] == models.Subscription.ObjectType.HOST
instance_data = instance["host"] if is_host else instance["service"]

data.update(instance_data)
bk_host_ids.append(instance_data.get("bk_host_id"))
instances_dict[create_node_id(data)] = instance
data.update(instance_data)
bk_host_ids.append(instance_data.get("bk_host_id"))
instances_dict[create_node_id(data)] = instance

# 对 instances 进行二次过滤
if instance_selector and bk_host_ids:
Expand Down

0 comments on commit bf9b5e8

Please sign in to comment.