Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
dd2e91cc
Commit
dd2e91cc
authored
Oct 25, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache pipeline status only for specific sha
parent
982276c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/cache/ci/project_pipeline_status.rb
lib/gitlab/cache/ci/project_pipeline_status.rb
+5
-5
No files found.
lib/gitlab/cache/ci/project_pipeline_status.rb
View file @
dd2e91cc
...
...
@@ -41,8 +41,8 @@ module Gitlab
end
end
def
self
.
cache_key_for_project
(
project
)
"
#{
Gitlab
::
Redis
::
Cache
::
CACHE_NAMESPACE
}
:projects/
#{
project
.
id
}
/pipeline_status"
def
self
.
cache_key_for_project
(
project
,
cache_sha
=
project
.
commit
&
.
sha
)
"
#{
Gitlab
::
Redis
::
Cache
::
CACHE_NAMESPACE
}
:projects/
#{
project
.
id
}
/pipeline_status
/
#{
cache_sha
}
"
end
def
self
.
update_for_pipeline
(
pipeline
)
...
...
@@ -84,9 +84,7 @@ module Gitlab
def
load_from_project
return
unless
commit
self
.
sha
=
commit
.
sha
self
.
status
=
commit
.
status
self
.
ref
=
project
.
default_branch
self
.
sha
,
self
.
status
,
self
.
ref
=
commit
.
sha
,
commit
.
status
,
project
.
default_branch
end
# We only cache the status for the HEAD commit of a project
...
...
@@ -104,6 +102,8 @@ module Gitlab
def
load_from_cache
Gitlab
::
Redis
::
Cache
.
with
do
|
redis
|
self
.
sha
,
self
.
status
,
self
.
ref
=
redis
.
hmget
(
cache_key
,
:sha
,
:status
,
:ref
)
self
.
status
=
nil
if
self
.
status
.
empty?
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment