Commit 6ba05b4d authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix shared runners minutes

Update only projects with used allowance, not all.
We have a millions of projects, and only a small portion of them use CI.
parent e26a80d1
......@@ -7,13 +7,15 @@ class ClearSharedRunnersMinutesWorker
def perform
return unless try_obtain_lease
ProjectStatistics.update_all(
shared_runners_seconds: 0,
shared_runners_seconds_last_reset: Time.now)
NamespaceStatistics.where.not(shared_runners_seconds: 0)
.update_all(
shared_runners_seconds: 0,
shared_runners_seconds_last_reset: Time.now)
NamespaceStatistics.update_all(
shared_runners_seconds: 0,
shared_runners_seconds_last_reset: Time.now)
ProjectStatistics.where.not(shared_runners_seconds: 0)
.update_all(
shared_runners_seconds: 0,
shared_runners_seconds_last_reset: Time.now)
end
private
......
---
title: Fix shared runners minutes query to update only projects with used allowance
merge_request:
author:
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