Commit fb86626c authored by Stan Hu's avatar Stan Hu

Merge branch 'ensure-minutes-reset-for-all-namespaces' into 'master'

Ensure namespace/project used minutes are reset

Closes gitlab-ce#65540 and gitlab-ce#66679

See merge request gitlab-org/gitlab-ee!15744
parents 780aeae7 439545c8
......@@ -15,11 +15,13 @@ class ClearSharedRunnersMinutesWorker
.update_all("extra_shared_runners_minutes_limit = #{extra_minutes_left_sql} FROM namespace_statistics")
Namespace.with_ci_minutes_notification_sent.each_batch do |namespaces|
namespaces.update_all(last_ci_minutes_notification_at: nil, last_ci_minutes_usage_notification_level: nil)
end
Namespace.select(:id).each_batch do |namespaces|
Namespace.transaction do
reset_statistics(NamespaceStatistics, namespaces)
reset_statistics(ProjectStatistics, namespaces)
namespaces.update_all(last_ci_minutes_notification_at: nil, last_ci_minutes_usage_notification_level: nil)
end
end
end
......
---
title: Ensure all CI minutes used are reset for all namespaces and relative projects
merge_request: 15744
author:
type: fixed
......@@ -4,7 +4,7 @@ describe ClearSharedRunnersMinutesWorker do
let(:worker) { described_class.new }
describe '#perform' do
let(:namespace) { create(:namespace, last_ci_minutes_notification_at: Time.now) }
let(:namespace) { create(:namespace) }
before do
expect_any_instance_of(described_class)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment