Commit 9520d2ff authored by Grzegorz Bizon's avatar Grzegorz Bizon

Memoize project active runners to avoid N+1 queries

parent 631bd9bf
...@@ -1418,7 +1418,9 @@ class Project < ActiveRecord::Base ...@@ -1418,7 +1418,9 @@ class Project < ActiveRecord::Base
end end
def any_runners?(&block) def any_runners?(&block)
all_runners.active.any?(&block) @active_runners ||= all_runners.active
@active_runners.any?(&block)
end end
def valid_runners_token?(token) def valid_runners_token?(token)
......
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