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
18bf543f
Commit
18bf543f
authored
Jul 13, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Elasticsearch indexer run as an async task
parent
c322ced6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
11 deletions
+35
-11
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-11
app/workers/elastic_commit_indexer_worker.rb
app/workers/elastic_commit_indexer_worker.rb
+17
-0
spec/workers/elastic_commit_indexer_worker_spec.rb
spec/workers/elastic_commit_indexer_worker_spec.rb
+14
-0
No files found.
CHANGELOG-EE
View file @
18bf543f
...
...
@@ -5,6 +5,7 @@ v 8.10.0 (unreleased)
- Fix EE keys fingerprint add index migration if came from CE
- Add todos for MR approvers !547
- Isolate EE LDAP library code in EE module (Part 1) !511
- Make Elasticsearch indexer run as an async task
v 8.9.6
- Avoid adding index for key fingerprint if it already exists. !539
...
...
app/services/git_push_service.rb
View file @
18bf543f
...
...
@@ -74,17 +74,9 @@ class GitPushService < BaseService
CreateCommitBuildsService
.
new
.
execute
(
@project
,
current_user
,
build_push_data
,
mirror_update:
mirror_update
)
ProjectCacheWorker
.
perform_async
(
@project
.
id
)
index_commits_blobs
if
current_application_settings
.
elasticsearch_indexing?
end
def
index_commits_blobs
indexer
=
Gitlab
::
Elastic
::
Indexer
.
new
indexer
.
run
(
@project
.
id
,
project
.
repository
.
path_to_repo
,
params
[
:oldrev
],
params
[
:newrev
]
)
if
current_application_settings
.
elasticsearch_indexing?
ElasticCommitIndexerWorker
.
perform_async
(
@project
.
id
,
params
[
:oldrev
],
params
[
:newrev
])
end
end
def
perform_housekeeping
...
...
app/workers/elastic_commit_indexer_worker.rb
0 → 100644
View file @
18bf543f
class
ElasticCommitIndexerWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :elasticsearch
def
perform
(
project_id
,
oldrev
,
newrev
)
project
=
Project
.
find
(
project_id
)
indexer
=
Gitlab
::
Elastic
::
Indexer
.
new
indexer
.
run
(
project_id
,
project
.
repository
.
path_to_repo
,
oldrev
,
newrev
)
end
end
spec/workers/elastic_commit_indexer_worker_spec.rb
0 → 100644
View file @
18bf543f
require
'spec_helper'
describe
ElasticCommitIndexerWorker
do
let
(
:project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
}
describe
'#perform'
do
it
'runs indexer'
do
expect_any_instance_of
(
Gitlab
::
Elastic
::
Indexer
).
to
receive
(
:run
)
subject
.
perform
(
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