Skip to content

Commit

Permalink
fix: 订阅实例属性is_latest为False导致巡检未执行 (closed TencentBlueKing#2189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa committed Apr 30, 2024
1 parent 1210116 commit ca18780
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/backend/subscription/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from apps.backend.subscription import tools
from apps.backend.subscription.constants import TASK_HOST_LIMIT
from apps.backend.subscription.errors import SubscriptionInstanceEmpty
from apps.backend.subscription.handler import SubscriptionTools
from apps.backend.subscription.steps import StepFactory, agent
from apps.core.gray.tools import GrayTools
from apps.node_man import constants, models
Expand Down Expand Up @@ -712,8 +713,10 @@ def run_subscription_task_and_create_instance(
not_exist_instance_id = set(instance_not_in_scope) - set(deleted_instance_info)
if not_exist_instance_id:
records = list(
models.SubscriptionInstanceRecord.objects.filter(
subscription_id=subscription.id, instance_id__in=not_exist_instance_id, is_latest=True
SubscriptionTools.fetch_latest_record_ids_in_same_inst_id(
models.SubscriptionInstanceRecord.objects.filter(
subscription_id=subscription.id, instance_id__in=not_exist_instance_id
)
)
)
for record in records:
Expand Down

0 comments on commit ca18780

Please sign in to comment.