Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Frye <joshfng@gmail.com>2016-05-31 23:01:16 +0300
committerJosh Frye <joshfng@gmail.com>2016-06-02 18:10:57 +0300
commit4d9622e7d3e927ad158d26c780fee64c6d8183bc (patch)
tree05707981c77f8871dd91dccf76d38adc09aa8ff4 /app/models/project.rb
parent2d05de7af8de9a11f5bdfec0dd3f294a0148d023 (diff)
Invalidate cache on build change
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 1375dab8c34..3b5ca05dc3f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1013,8 +1013,12 @@ class Project < ActiveRecord::Base
end
def running_or_pending_build_count
- Rails.cache.fetch(['projects', id, 'running_or_pending_build_count'], expires_in: 60) do
+ Rails.cache.fetch(['projects', id, 'running_or_pending_build_count']) do
builds.running_or_pending.count(:all)
end
end
+
+ def expire_running_or_pending_build_count
+ Rails.cache.delete(['projects', id, 'running_or_pending_build_count'])
+ end
end