BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bbd1be00
Unverified
Commit
bbd1be00
authored
May 12, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change project list cache key to use route.cache_key instead of namespace
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1028e053
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
22 deletions
+5
-22
projects_helper.rb
app/helpers/projects_helper.rb
+1
-2
namespace.rb
app/models/namespace.rb
+0
-4
route.rb
app/models/route.rb
+1
-1
dz-project-list-cache-key.yml
changelogs/unreleased/dz-project-list-cache-key.yml
+1
-1
projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+2
-8
namespace_spec.rb
spec/models/namespace_spec.rb
+0
-6
No files found.
app/helpers/projects_helper.rb
View file @
bbd1be00
...
...
@@ -158,8 +158,7 @@ module ProjectsHelper
def
project_list_cache_key
(
project
)
key
=
[
'parent/'
+
project
.
namespace
.
parent_full_path
,
project
.
namespace
.
cache_key
,
project
.
route
.
cache_key
,
project
.
cache_key
,
controller
.
controller_name
,
controller
.
action_name
,
...
...
app/models/namespace.rb
View file @
bbd1be00
...
...
@@ -224,10 +224,6 @@ class Namespace < ActiveRecord::Base
parent
.
present?
end
def
parent_full_path
full_path
.
split
(
'/'
)[
0
...-
1
].
join
(
'/'
)
end
private
def
repository_storage_paths
...
...
app/models/route.rb
View file @
bbd1be00
...
...
@@ -35,7 +35,7 @@ class Route < ActiveRecord::Base
old_path
=
route
.
path
# Callbacks must be run manually
route
.
update_columns
(
attributes
)
route
.
update_columns
(
attributes
.
merge
(
updated_at:
Time
.
now
)
)
# We are not calling route.delete_conflicting_redirects here, in hopes
# of avoiding deadlocks. The parent (self, in this method) already
...
...
changelogs/unreleased/dz-project-list-cache-key.yml
View file @
bbd1be00
---
title
:
Add parent full path to
project list cache key
title
:
Use route.cache_key for
project list cache key
merge_request
:
11325
author
:
spec/helpers/projects_helper_spec.rb
View file @
bbd1be00
...
...
@@ -66,14 +66,8 @@ describe ProjectsHelper do
describe
"#project_list_cache_key"
,
redis:
true
do
let
(
:project
)
{
create
(
:project
)
}
it
"includes the namespace"
do
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
project
.
namespace
.
cache_key
)
end
it
"includes the parent namespace in case of subgroup"
do
project
=
create
(
:project
,
group:
create
(
:group
,
:nested
))
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
"parent/
#{
project
.
namespace
.
parent
.
path
}
"
)
it
"includes the route"
do
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
project
.
route
.
cache_key
)
end
it
"includes the project"
do
...
...
spec/models/namespace_spec.rb
View file @
bbd1be00
...
...
@@ -332,10 +332,4 @@ describe Namespace, models: true do
it
{
expect
(
group
.
all_projects
.
to_a
).
to
eq
([
project2
,
project1
])
}
end
describe
'#parent_full_path'
do
let
(
:namespace
)
{
create
(
:group
,
:nested
)
}
it
{
expect
(
namespace
.
parent_full_path
).
to
eq
(
namespace
.
parent
.
path
)
}
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