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
87a1ba14
Commit
87a1ba14
authored
Sep 25, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expire RequestStore cache properly
parent
3640292b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
lib/gitlab/repository_cache_adapter.rb
lib/gitlab/repository_cache_adapter.rb
+8
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+7
-0
No files found.
lib/gitlab/repository_cache_adapter.rb
View file @
87a1ba14
...
@@ -136,6 +136,8 @@ module Gitlab
...
@@ -136,6 +136,8 @@ module Gitlab
clear_memoization
(
memoizable_name
(
name
))
clear_memoization
(
memoizable_name
(
name
))
end
end
expire_request_store_method_caches
(
methods
)
end
end
private
private
...
@@ -144,6 +146,12 @@ module Gitlab
...
@@ -144,6 +146,12 @@ module Gitlab
"
#{
name
.
to_s
.
tr
(
'?!'
,
''
)
}
"
"
#{
name
.
to_s
.
tr
(
'?!'
,
''
)
}
"
end
end
def
expire_request_store_method_caches
(
methods
)
methods
.
each
do
|
name
|
request_store_cache
.
expire
(
name
)
end
end
# All cached repository methods depend on the existence of a Git repository,
# All cached repository methods depend on the existence of a Git repository,
# so if the repository doesn't exist, we already know not to call it.
# so if the repository doesn't exist, we already know not to call it.
def
fallback_early?
(
method_name
)
def
fallback_early?
(
method_name
)
...
...
spec/models/repository_spec.rb
View file @
87a1ba14
...
@@ -1757,12 +1757,19 @@ describe Repository do
...
@@ -1757,12 +1757,19 @@ describe Repository do
describe
'#expire_exists_cache'
do
describe
'#expire_exists_cache'
do
let
(
:cache
)
{
repository
.
send
(
:cache
)
}
let
(
:cache
)
{
repository
.
send
(
:cache
)
}
let
(
:request_store_cache
)
{
repository
.
send
(
:request_store_cache
)
}
it
'expires the cache'
do
it
'expires the cache'
do
expect
(
cache
).
to
receive
(
:expire
).
with
(
:exists?
)
expect
(
cache
).
to
receive
(
:expire
).
with
(
:exists?
)
repository
.
expire_exists_cache
repository
.
expire_exists_cache
end
end
it
'expires the request store cache'
,
:request_store
do
expect
(
request_store_cache
).
to
receive
(
:expire
).
with
(
:exists?
)
repository
.
expire_exists_cache
end
end
end
describe
'#xcode_project?'
do
describe
'#xcode_project?'
do
...
...
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