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
a778d4f7
Commit
a778d4f7
authored
3 years ago
by
Dmitry Gruzd
Committed by
Matthias Käppler
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unreachable ES url exception
EE: true Changelog: fixed
parent
2f9eec2f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
ee/lib/gitlab/elastic/client.rb
ee/lib/gitlab/elastic/client.rb
+8
-1
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
+1
-1
ee/spec/lib/gitlab/elastic/client_spec.rb
ee/spec/lib/gitlab/elastic/client_spec.rb
+7
-3
No files found.
ee/lib/gitlab/elastic/client.rb
View file @
a778d4f7
...
...
@@ -7,12 +7,19 @@ module Gitlab
module
Client
extend
Gitlab
::
Utils
::
StrongMemoize
OPEN_TIMEOUT
=
5
# Takes a hash as returned by `ApplicationSetting#elasticsearch_config`,
# and configures itself based on those parameters
def
self
.
build
(
config
)
base_config
=
{
urls:
config
[
:url
],
request_timeout:
config
[
:client_request_timeout
],
transport_options:
{
request:
{
timeout:
config
[
:client_request_timeout
],
open_timeout:
OPEN_TIMEOUT
}
},
randomize_hosts:
true
,
retry_on_failure:
true
}.
compact
...
...
This diff is collapsed.
Click to expand it.
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
View file @
a778d4f7
...
...
@@ -18,7 +18,7 @@ RSpec.describe Gitlab::Elastic::Helper, :request_store do
end
after
do
helper
.
delete_index
(
index_name:
@index_name
)
helper
.
delete_index
(
index_name:
@index_name
)
if
@index_name
end
describe
'.new'
do
...
...
This diff is collapsed.
Click to expand it.
ee/spec/lib/gitlab/elastic/client_spec.rb
View file @
a778d4f7
...
...
@@ -18,14 +18,18 @@ RSpec.describe Gitlab::Elastic::Client do
end
it
'does not set request timeout in transport'
do
expect
(
client
.
transport
.
options
).
not_to
include
(
:request_timeout
)
options
=
client
.
transport
.
options
.
dig
(
:transport_options
,
:request
)
expect
(
options
).
to
include
(
open_timeout:
described_class
::
OPEN_TIMEOUT
,
timeout:
nil
)
end
context
'with client_request_timeout in config'
do
let
(
:params
)
{
{
url:
'http://dummy-elastic:9200'
,
client_request_timeout:
30
}
}
it
'does not set request timeout in transport'
do
expect
(
client
.
transport
.
options
).
to
include
(
request_timeout:
30
)
it
'sets request timeout in transport'
do
options
=
client
.
transport
.
options
.
dig
(
:transport_options
,
:request
)
expect
(
options
).
to
include
(
open_timeout:
described_class
::
OPEN_TIMEOUT
,
timeout:
30
)
end
end
end
...
...
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