diff options
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 525a82c7534..1375dab8c34 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1011,4 +1011,10 @@ class Project < ActiveRecord::Base update_attribute(:pending_delete, true) end + + def running_or_pending_build_count + Rails.cache.fetch(['projects', id, 'running_or_pending_build_count'], expires_in: 60) do + builds.running_or_pending.count(:all) + end + end end |