Commit c50dc610 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Memoize project active runners to avoid N+1 queries

parent 77c44f59
...@@ -1443,7 +1443,9 @@ class Project < ActiveRecord::Base ...@@ -1443,7 +1443,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