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:
Diffstat (limited to 'lib/gitlab/cache/ci/project_pipeline_status.rb')
-rw-r--r--lib/gitlab/cache/ci/project_pipeline_status.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/cache/ci/project_pipeline_status.rb b/lib/gitlab/cache/ci/project_pipeline_status.rb
index b2630a7ad7a..4beb8f54abf 100644
--- a/lib/gitlab/cache/ci/project_pipeline_status.rb
+++ b/lib/gitlab/cache/ci/project_pipeline_status.rb
@@ -9,6 +9,8 @@ module Gitlab
class ProjectPipelineStatus
include Gitlab::Utils::StrongMemoize
+ STATUS_KEY_TTL = 8.hours
+
attr_accessor :sha, :status, :ref, :project, :loaded
def self.load_for_project(project)
@@ -89,12 +91,17 @@ module Gitlab
self.sha, self.status, self.ref = redis.hmget(cache_key, :sha, :status, :ref)
self.status = nil if self.status.empty?
+
+ redis.expire(cache_key, STATUS_KEY_TTL)
end
end
def store_in_cache
with_redis do |redis|
- redis.mapped_hmset(cache_key, { sha: sha, status: status, ref: ref })
+ redis.pipelined do |p|
+ p.mapped_hmset(cache_key, { sha: sha, status: status, ref: ref })
+ p.expire(cache_key, STATUS_KEY_TTL)
+ end
end
end