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
165c9e2d
Commit
165c9e2d
authored
Feb 03, 2020
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Elasticsearch BadRequest exception
parent
2ce5ef22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
ee/lib/elastic/latest/routing.rb
ee/lib/elastic/latest/routing.rb
+4
-0
ee/spec/lib/elastic/latest/routing_spec.rb
ee/spec/lib/elastic/latest/routing_spec.rb
+6
-0
No files found.
ee/lib/elastic/latest/routing.rb
View file @
165c9e2d
...
...
@@ -5,6 +5,8 @@ module Elastic
module
Routing
extend
ActiveSupport
::
Concern
ES_ROUTING_MAX_COUNT
=
128
def
routing_options
(
options
)
return
{}
if
Feature
.
disabled?
(
:elasticsearch_use_routing
)
return
{}
if
options
[
:public_and_internal_projects
]
...
...
@@ -31,6 +33,8 @@ module Elastic
private
def
build_routing
(
ids
)
return
[]
if
ids
.
count
>
ES_ROUTING_MAX_COUNT
ids
.
map
{
|
id
|
"project_
#{
id
}
"
}.
join
(
','
)
end
end
...
...
ee/spec/lib/elastic/latest/routing_spec.rb
View file @
165c9e2d
...
...
@@ -63,6 +63,12 @@ describe Elastic::Latest::Routing do
expect
(
subject
.
routing_options
(
options
)).
to
eq
({
routing:
project_routing
})
end
it
'returns empty hash when there are too many project_ids'
do
max_count
=
included_class
::
ES_ROUTING_MAX_COUNT
expect
(
subject
.
routing_options
({
project_ids:
1
.
upto
(
max_count
+
1
).
to_a
})).
to
eq
({})
end
end
context
'when feature flag is disabled'
do
...
...
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