Fix memoization-related rubocop offense in project

This commit is contained in:
Grzegorz Bizon 2018-05-22 14:03:02 +02:00
parent e4eb330af7
commit be3a0377da
2 changed files with 7 additions and 5 deletions

View file

@ -1417,10 +1417,14 @@ class Project < ActiveRecord::Base
Ci::Runner.from("(#{union.to_sql}) ci_runners")
end
def any_runners?(&block)
@active_runners ||= all_runners.active
def active_runners
strong_memoize(:active_runners) do
all_runners.active
end
end
@active_runners.any?(&block)
def any_runners?(&block)
active_runners.any?(&block)
end
def valid_runners_token?(token)

View file

@ -47,8 +47,6 @@ module Gitlab
# Sends a notification based on the number of executed SQL queries.
def act_upon_results
puts "XXXX\n\n\n\n\n #{count} \n\n\nXXXX"
return unless threshold_exceeded?
error = ThresholdExceededError.new(error_message)