Skip to content
代码片段 群组 项目
提交 31d878a6 编辑于 作者: Matija Čupić's avatar Matija Čupić 提交者: Rémy Coutable
浏览文件

Reduce DB load when resetting CI minute notifications

上级 f0337d33
No related branches found
No related tags found
无相关合并请求
---
title: Reduce DB load when resetting CI minute notifications.
merge_request: 55765
author:
type: performance
......@@ -69,6 +69,11 @@ module Namespace
where("EXISTS (?)", matcher)
end
scope :without_last_ci_minutes_notification, -> do
where.not(last_ci_minutes_notification_at: nil)
.or(where.not(last_ci_minutes_usage_notification_level: nil))
end
delegate :shared_runners_seconds, :shared_runners_seconds_last_reset, to: :namespace_statistics, allow_nil: true
delegate :additional_purchased_storage_size, :additional_purchased_storage_size=,
......
......@@ -111,9 +111,10 @@ def reset_shared_runners_seconds!(namespaces)
end
def reset_ci_minutes_notifications!(namespaces)
namespaces.update_all(
namespaces.without_last_ci_minutes_notification.update_all(
last_ci_minutes_notification_at: nil,
last_ci_minutes_usage_notification_level: nil)
last_ci_minutes_usage_notification_level: nil
)
end
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册