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
03b63f55
Commit
03b63f55
authored
Feb 26, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: fixes after review
parent
9ef5b8ae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
+30
-28
app/workers/elastic_indexer_worker.rb
app/workers/elastic_indexer_worker.rb
+30
-28
No files found.
app/workers/elastic_indexer_worker.rb
View file @
03b63f55
...
...
@@ -6,18 +6,22 @@ class ElasticIndexerWorker
Client
=
Elasticsearch
::
Client
.
new
(
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
)
def
perform
(
operation
,
klass
,
record_id
,
options
=
{})
cklass
=
klass
.
constantize
def
perform
(
operation
,
class_name
,
record_id
,
options
=
{})
klass
=
class_name
.
constantize
case
operation
.
to_s
when
/index|update/
record
=
c
klass
.
find
(
record_id
)
record
=
klass
.
find
(
record_id
)
record
.
__elasticsearch__
.
client
=
Client
record
.
__elasticsearch__
.
__send__
"
#{
operation
}
_document"
when
/delete/
Client
.
delete
index:
cklass
.
index_name
,
type:
c
klass
.
document_type
,
id:
record_id
Client
.
delete
index:
klass
.
index_name
,
type:
klass
.
document_type
,
id:
record_id
if
cklass
==
Project
clear_project_indexes
(
record_id
)
if
klass
==
Project
end
end
def
clear_project_indexes
(
record_id
)
# Remove repository index
Client
.
delete_by_query
({
index:
Repository
.
__elasticsearch__
.
index_name
,
...
...
@@ -41,6 +45,4 @@ class ElasticIndexerWorker
}
})
end
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