Change `ClearNamespaceSharedRunnersMinutesService` to use the new monthly data
Problem
ClearNamespaceSharedRunnersMinutesService
is used when an admin wants to reset the CI minutes consumption for a namespace. This currently uses the legacy table namespace_statistics
. We should instead use the new ci_namespace_monthly_usages
table.
Solution
- Rename the service to
Ci::Minutes::ResetService
- Use
Ci::Minutes::NamespaceMonthlyUsage.current_month.find_by(namespace: namespace)&.update!(...)
- Do the above side-by-side to the existing solution. In essence we need to reset both legacy and new method. Consider making the legacy method being disabled via a feature flag.
Rollout
- Introduce a feature flag to enable reset of the new method
- Once enabled and fully rolled out we should have the 2 resets side-by-side
- Disable the feature flag that wrapped the legacy method so we can only use the new method
Edited by Fabio Pitino