Skip to content

Commit

Permalink
fix: fix budget alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
whdalsrnt committed Jan 22, 2024
1 parent 3ea2417 commit 61e322b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/spaceone/cost_analysis/manager/budget_usage_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def notify_budget_usage(self, budget_vo: Budget):
notification_type = notification.notification_type
is_notify = False

if budget_vo.time_unit == "MONTHLY":
if budget_vo.time_unit == "TOTAL":
budget_usage_vos = self.filter_budget_usages(
budget_id=budget_id,
workspace_id=workspace_id,
Expand All @@ -134,6 +134,13 @@ def notify_budget_usage(self, budget_vo: Budget):
domain_id=domain_id,
date=current_month,
)

if budget_usage_vos.count() == 0:
_LOGGER.debug(
f"[notify_budget_usage] budget_usage_vos is empty: {budget_id}"
)
continue

total_budget_usage = budget_usage_vos[0].cost
budget_limit = budget_usage_vos[0].limit

Expand Down

0 comments on commit 61e322b

Please sign in to comment.