From bc29e98ddf0182496d91f6d13e32e106c2b61b01 Mon Sep 17 00:00:00 2001 From: Jongmin Kim Date: Tue, 15 Oct 2024 10:32:29 +0900 Subject: [PATCH] refactor: optimize performance Signed-off-by: Jongmin Kim --- src/spaceone/cost_analysis/service/job_service.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/spaceone/cost_analysis/service/job_service.py b/src/spaceone/cost_analysis/service/job_service.py index b9c9095..97de3f3 100644 --- a/src/spaceone/cost_analysis/service/job_service.py +++ b/src/spaceone/cost_analysis/service/job_service.py @@ -814,12 +814,13 @@ def _delete_changed_cost_data( if end: query["filter"].append({"k": "billed_month", "v": end, "o": "lte"}) + job_ids = self._distinct_job_id( + copy.deepcopy(query["filter"]), domain_id, job_vo.data_source_id + ) + for key, value in change_filter.items(): query["filter"].append({"k": key, "v": value, "o": "eq"}) - job_ids = self._distinct_job_id( - query["filter"], domain_id, job_vo.data_source_id - ) for job_id in job_ids: if job_vo.job_id == job_id: continue