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
3c0ab15a
Commit
3c0ab15a
authored
Apr 26, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not fsck projects less than a day old
This should bring the number of false positives down.
parent
f127edd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
app/workers/repository_check/batch_worker.rb
app/workers/repository_check/batch_worker.rb
+2
-2
spec/workers/repository_check/batch_worker_spec.rb
spec/workers/repository_check/batch_worker_spec.rb
+11
-4
No files found.
app/workers/repository_check/batch_worker.rb
View file @
3c0ab15a
...
...
@@ -33,8 +33,8 @@ module RepositoryCheck
# has to sit and wait for this query to finish.
def
project_ids
limit
=
10_000
never_checked_projects
=
Project
.
where
(
'last_repository_check_at IS NULL
'
).
limit
(
limit
).
pluck
(
:id
)
never_checked_projects
=
Project
.
where
(
'last_repository_check_at IS NULL
AND created_at < ?'
,
24
.
hours
.
ago
).
limit
(
limit
).
pluck
(
:id
)
old_check_projects
=
Project
.
where
(
'last_repository_check_at < ?'
,
1
.
month
.
ago
).
reorder
(
'last_repository_check_at ASC'
).
limit
(
limit
).
pluck
(
:id
)
never_checked_projects
+
old_check_projects
...
...
spec/workers/repository_check/batch_worker_spec.rb
View file @
3c0ab15a
...
...
@@ -4,7 +4,7 @@ describe RepositoryCheck::BatchWorker do
subject
{
described_class
.
new
}
it
'prefers projects that have never been checked'
do
projects
=
create_list
(
:project
,
3
)
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
4
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
months
.
ago
)
...
...
@@ -12,7 +12,7 @@ describe RepositoryCheck::BatchWorker do
end
it
'sorts projects by last_repository_check_at'
do
projects
=
create_list
(
:project
,
3
)
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
2
.
months
.
ago
)
projects
[
1
].
update_column
(
:last_repository_check_at
,
4
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
months
.
ago
)
...
...
@@ -21,7 +21,7 @@ describe RepositoryCheck::BatchWorker do
end
it
'excludes projects that were checked recently'
do
projects
=
create_list
(
:project
,
3
)
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
2
.
days
.
ago
)
projects
[
1
].
update_column
(
:last_repository_check_at
,
2
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
days
.
ago
)
...
...
@@ -30,10 +30,17 @@ describe RepositoryCheck::BatchWorker do
end
it
'does nothing when repository checks are disabled'
do
create
(
:empty_project
)
create
(
:empty_project
,
created_at:
1
.
week
.
ago
)
current_settings
=
double
(
'settings'
,
repository_checks_enabled:
false
)
expect
(
subject
).
to
receive
(
:current_settings
)
{
current_settings
}
expect
(
subject
.
perform
).
to
eq
(
nil
)
end
it
'skips projects created less than 24 hours ago'
do
project
=
create
(
:empty_project
)
project
.
update_column
(
:created_at
,
23
.
hours
.
ago
)
expect
(
subject
.
perform
).
to
eq
([])
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