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
b4e76e64
Commit
b4e76e64
authored
Aug 26, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ES] Elastic workers should check settings each time when they are running
parent
80cd8f3e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
188 additions
and
101 deletions
+188
-101
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/workers/elastic_commit_indexer_worker.rb
app/workers/elastic_commit_indexer_worker.rb
+3
-0
app/workers/elastic_indexer_worker.rb
app/workers/elastic_indexer_worker.rb
+3
-0
spec/workers/elastic_commit_indexer_worker_spec.rb
spec/workers/elastic_commit_indexer_worker_spec.rb
+12
-0
spec/workers/elastic_indexer_worker_spec.rb
spec/workers/elastic_indexer_worker_spec.rb
+169
-101
No files found.
CHANGELOG-EE
View file @
b4e76e64
...
...
@@ -4,6 +4,7 @@ v 8.12.0 (Unreleased)
v 8.11.3 (Unreleased)
- [ES] Add logging to indexer
- Set the correct `GL_PROTOCOL` when rebasing !691
- [ES] Elasticsearch workers checks ES settings before running
v 8.11.2
- Additional documentation on protected branches for EE
...
...
app/workers/elastic_commit_indexer_worker.rb
View file @
b4e76e64
class
ElasticCommitIndexerWorker
include
Sidekiq
::
Worker
include
Gitlab
::
CurrentSettings
sidekiq_options
queue: :elasticsearch
,
retry:
2
def
perform
(
project_id
,
oldrev
=
nil
,
newrev
=
nil
)
return
true
unless
current_application_settings
.
elasticsearch_indexing?
project
=
Project
.
find
(
project_id
)
repository
=
project
.
repository
...
...
app/workers/elastic_indexer_worker.rb
View file @
b4e76e64
class
ElasticIndexerWorker
include
Sidekiq
::
Worker
include
Elasticsearch
::
Model
::
Client
::
ClassMethods
include
Gitlab
::
CurrentSettings
sidekiq_options
queue: :elasticsearch
,
retry:
2
ISSUE_TRACKED_FIELDS
=
%w(assignee_id author_id confidential)
def
perform
(
operation
,
class_name
,
record_id
,
options
=
{})
return
true
unless
current_application_settings
.
elasticsearch_indexing?
klass
=
class_name
.
constantize
case
operation
.
to_s
...
...
spec/workers/elastic_commit_indexer_worker_spec.rb
View file @
b4e76e64
...
...
@@ -6,6 +6,10 @@ describe ElasticCommitIndexerWorker do
subject
{
described_class
.
new
}
describe
'#perform'
do
before
do
stub_application_setting
(
elasticsearch_indexing:
true
)
end
it
'runs indexer'
do
expect_any_instance_of
(
Gitlab
::
Elastic
::
Indexer
).
to
receive
(
:run
)
subject
.
perform
(
project
.
id
,
'0000'
,
'0000'
)
...
...
@@ -27,5 +31,13 @@ describe ElasticCommitIndexerWorker do
expect
(
subject
.
perform
(
project
.
id
)).
to
be_truthy
end
it
'returns true if ES disabled'
do
stub_application_setting
(
elasticsearch_indexing:
false
)
expect_any_instance_of
(
Gitlab
::
Elastic
::
Indexer
).
not_to
receive
(
:run
)
expect
(
subject
.
perform
(
1
)).
to
be_truthy
end
end
end
spec/workers/elastic_indexer_worker_spec.rb
View file @
b4e76e64
This diff is collapsed.
Click to expand it.
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