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
b33c539e
Commit
b33c539e
authored
Jul 25, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dicouple ES index update from RepositoryUpdateMirrorWorker
parent
6fef1152
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
4 deletions
+15
-4
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/models/project.rb
app/models/project.rb
+1
-2
app/workers/elastic_commit_indexer_worker.rb
app/workers/elastic_commit_indexer_worker.rb
+5
-2
spec/workers/elastic_commit_indexer_worker_spec.rb
spec/workers/elastic_commit_indexer_worker_spec.rb
+8
-0
No files found.
CHANGELOG-EE
View file @
b33c539e
...
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased)
v 8.10.2 (unreleased)
- Dicouple an ES index update from RepositoryUpdateMirrorWorker
v 8.10.1
- No EE-specific changes
...
...
app/models/project.rb
View file @
b33c539e
...
...
@@ -240,8 +240,7 @@ class Project < ActiveRecord::Base
end
if
current_application_settings
.
elasticsearch_indexing?
project
.
repository
.
index_blobs
project
.
repository
.
index_commits
ElasticCommitIndexerWorker
.
perform_async
(
project
.
id
)
end
end
...
...
app/workers/elastic_commit_indexer_worker.rb
View file @
b33c539e
...
...
@@ -3,13 +3,16 @@ class ElasticCommitIndexerWorker
sidekiq_options
queue: :elasticsearch
def
perform
(
project_id
,
oldrev
,
newrev
)
def
perform
(
project_id
,
oldrev
=
nil
,
newrev
=
nil
)
project
=
Project
.
find
(
project_id
)
repository
=
project
.
repository
return
true
unless
repository
.
exists?
&&
!
repository
.
empty?
indexer
=
Gitlab
::
Elastic
::
Indexer
.
new
indexer
.
run
(
project_id
,
project
.
repository
.
path_to_repo
,
repository
.
path_to_repo
,
oldrev
,
newrev
)
...
...
spec/workers/elastic_commit_indexer_worker_spec.rb
View file @
b33c539e
...
...
@@ -10,5 +10,13 @@ describe ElasticCommitIndexerWorker do
expect_any_instance_of
(
Gitlab
::
Elastic
::
Indexer
).
to
receive
(
:run
)
subject
.
perform
(
project
.
id
,
'0000'
,
'0000'
)
end
it
'does not run indexer when project is empty'
do
empty_project
=
create
:empty_project
expect_any_instance_of
(
Gitlab
::
Elastic
::
Indexer
).
not_to
receive
(
:run
)
subject
.
perform
(
empty_project
.
id
,
'0000'
,
'0000'
)
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