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
Léo-Paul Géneau
gitlab-ce
Commits
720ef51b
Commit
720ef51b
authored
Mar 27, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if repo exists before attempting to update cache info
Closes #14361
parent
c1834664
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
app/workers/project_cache_worker.rb
app/workers/project_cache_worker.rb
+3
-0
spec/workers/project_cache_worker_spec.rb
spec/workers/project_cache_worker_spec.rb
+27
-0
No files found.
app/workers/project_cache_worker.rb
View file @
720ef51b
...
@@ -5,6 +5,9 @@ class ProjectCacheWorker
...
@@ -5,6 +5,9 @@ class ProjectCacheWorker
def
perform
(
project_id
)
def
perform
(
project_id
)
project
=
Project
.
find
(
project_id
)
project
=
Project
.
find
(
project_id
)
return
unless
project
.
repository
.
exists?
project
.
update_repository_size
project
.
update_repository_size
project
.
update_commit_count
project
.
update_commit_count
...
...
spec/workers/project_cache_worker_spec.rb
0 → 100644
View file @
720ef51b
require
'spec_helper'
describe
ProjectCacheWorker
do
let
(
:project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
}
describe
'#perform'
do
it
'updates project cache data'
do
expect_any_instance_of
(
Repository
).
to
receive
(
:size
)
expect_any_instance_of
(
Repository
).
to
receive
(
:commit_count
)
expect_any_instance_of
(
Project
).
to
receive
(
:update_repository_size
)
expect_any_instance_of
(
Project
).
to
receive
(
:update_commit_count
)
subject
.
perform
(
project
.
id
)
end
it
'handles missing repository data'
do
expect_any_instance_of
(
Repository
).
to
receive
(
:exists?
).
and_return
(
false
)
expect_any_instance_of
(
Repository
).
not_to
receive
(
:size
)
subject
.
perform
(
project
.
id
)
end
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