Remove unused CounterAttribute methods

What does this MR do and why?

Removes unused methods from the CounterAttribute concern:

  • update_counters_with_lease - Primary target (public method, never called)
  • detect_race_on_record - Cascade removal (private, only called by above)
  • database_lock_key - Cascade removal (private, only called by above)
  • include Gitlab::ExclusiveLeaseHelpers - Unused after method removals

These methods were identified as unused by scripts/lint/unused_code.rb and verified through comprehensive codebase search including metaprogramming patterns.

Related to #542966 (closed)

Metrics

Metric Value
Methods removed 3
Lines removed (source) 48
Lines removed (spec) 50
Lines removed (config) 2
Total lines removed 100
Spec runtime saved 8.91 seconds per pipeline

Estimated CI Savings

Estimate Pipelines/Month Time Saved/Month Cost Saved/Month Cost Saved/Year
Pessimistic 15,000 37.1 hrs $66.83 $801.90
Moderate 30,000 74.3 hrs $133.65 $1,603.80
Optimistic 50,000 123.8 hrs $222.75 $2,673.00

Based on 8.91 seconds saved per pipeline × $0.03/minute (large runners: 3x cost factor on $10/1000 base minutes)

Verification

  • No direct callers found (excluding specs)
  • No metaprogramming references (send, public_send, method)
  • No symbol references (:update_counters_with_lease)
  • No Rails callbacks using these methods
  • No delegation patterns
  • All remaining specs pass (67 examples, 0 failures)
  • Rubocop clean

MR acceptance checklist

  • Tests removed for deleted functionality
  • Changelog entry added
Edited by Kerri Miller

Merge request reports

Loading
Loading