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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7f90ff77
Commit
7f90ff77
authored
May 02, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load project ids from tracking database when searching for batch
Closes gitlab-org/gitlab-ee#5564
parent
64c698c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
0 deletions
+81
-0
app/workers/repository_check/batch_worker.rb
app/workers/repository_check/batch_worker.rb
+2
-0
ee/app/workers/ee/repository_check/batch_worker.rb
ee/app/workers/ee/repository_check/batch_worker.rb
+31
-0
ee/changelogs/unreleased/tc-repo-verify-mails-ee.yml
ee/changelogs/unreleased/tc-repo-verify-mails-ee.yml
+5
-0
ee/spec/workers/ee/repository_check/batch_worker_spec.rb
ee/spec/workers/ee/repository_check/batch_worker_spec.rb
+43
-0
No files found.
app/workers/repository_check/batch_worker.rb
View file @
7f90ff77
module
RepositoryCheck
class
BatchWorker
prepend
::
EE
::
RepositoryCheck
::
BatchWorker
include
ApplicationWorker
include
CronjobQueue
...
...
ee/app/workers/ee/repository_check/batch_worker.rb
0 → 100644
View file @
7f90ff77
module
EE
module
RepositoryCheck
module
BatchWorker
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
private
override
:never_checked_project_ids
def
never_checked_project_ids
(
batch_size
)
return
super
unless
::
Gitlab
::
Geo
.
secondary?
Geo
::
ProjectRegistry
.
synced_repos
.
synced_wikis
.
where
(
last_repository_check_at:
nil
)
.
where
(
'last_repository_synced_at < ?'
,
24
.
hours
.
ago
)
.
where
(
'last_wiki_synced_at < ?'
,
24
.
hours
.
ago
)
.
limit
(
batch_size
).
pluck
(
:project_id
)
end
override
:old_checked_project_ids
def
old_checked_project_ids
(
batch_size
)
return
super
unless
::
Gitlab
::
Geo
.
secondary?
Geo
::
ProjectRegistry
.
synced_repos
.
synced_wikis
.
where
(
'last_repository_check_at < ?'
,
1
.
month
.
ago
)
.
reorder
(
last_repository_check_at: :asc
)
.
limit
(
batch_size
).
pluck
(
:project_id
)
end
end
end
end
ee/changelogs/unreleased/tc-repo-verify-mails-ee.yml
0 → 100644
View file @
7f90ff77
---
title
:
Run repository verification on Geo secondary
merge_request
:
5550
author
:
type
:
added
ee/spec/workers/ee/repository_check/batch_worker_spec.rb
0 → 100644
View file @
7f90ff77
require
'spec_helper'
describe
EE
::
RepositoryCheck
::
BatchWorker
do
include
::
EE
::
GeoHelpers
subject
(
:worker
)
{
RepositoryCheck
::
BatchWorker
.
new
}
context
'Geo primary'
do
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
before
do
stub_current_geo_node
(
primary
)
end
it
'loads project ids from main database'
do
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
expect
(
worker
.
perform
).
to
eq
(
projects
.
map
(
&
:id
))
end
end
context
'Geo secondary'
do
set
(
:secondary
)
{
create
(
:geo_node
)
}
before
do
stub_current_geo_node
(
secondary
)
end
it
'loads project ids from tracking database'
do
project_registries
=
create_list
(
:geo_project_registry
,
3
,
:synced
)
expect
(
worker
.
perform
).
to
eq
(
project_registries
.
map
(
&
:project_id
))
end
it
'loads project ids that were checked more than a month ago from tracking database'
do
project_registries
=
create_list
(
:geo_project_registry
,
3
,
:synced
,
last_repository_check_failed:
false
,
last_repository_check_at:
42
.
days
.
ago
)
expect
(
worker
.
perform
).
to
eq
(
project_registries
.
map
(
&
: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