Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gitlab-External-Templates
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adri
Gitlab-External-Templates
Commits
06156888
Commit
06156888
authored
7 years ago
by
Valery Sizov
Browse files
Options
Downloads
Patches
Plain Diff
[Elasticsearch][index_database task] Limit the number of workers
parent
df2d3773
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/tasks/gitlab/elastic.rake
+20
-1
20 additions, 1 deletion
lib/tasks/gitlab/elastic.rake
with
20 additions
and
1 deletion
lib/tasks/gitlab/elastic.rake
+
20
−
1
View file @
06156888
...
...
@@ -88,7 +88,26 @@ namespace :gitlab do
end
desc
"GitLab | Elasticsearch | Index all database objects"
multitask
index_database:
INDEXABLE_CLASSES
.
values
task
index_database: :environment
do
Thread
.
abort_on_exception
=
true
queue
=
Queue
.
new
workers_number
=
4
INDEXABLE_CLASSES
.
values
.
each
{
|
task_name
|
queue
<<
task_name
}
workers
=
Array
.
new
(
workers_number
)
do
Thread
.
new
do
begin
while
task_name
=
queue
.
pop
(
true
)
Rake
::
Task
[
"gitlab:elastic:
#{
task_name
}
"
].
invoke
end
rescue
ThreadError
end
end
end
workers
.
each
(
&
:join
)
end
desc
"GitLab | Elasticsearch | Create empty index"
task
create_empty_index: :environment
do
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment