Skip to content

Commit

Permalink
Remove retries from EC
Browse files Browse the repository at this point in the history
  • Loading branch information
kag728 committed Dec 5, 2023
1 parent 5a907df commit 9f11b04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
11 changes: 0 additions & 11 deletions lib/elastomer_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ def api_spec
#
# Returns a Faraday::Connection
def connection
# retry_options = {
# max: 2,
# interval: 0.05,
# interval_randomness: 0.5,
# backoff_factor: 2,
# methods: RETRYABLE_METHODS,
# exceptions: Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [ElastomerClient::Client::ServerError, ElastomerClient::Client::TimeoutError, ElastomerClient::Client::ConnectionFailed, ElastomerClient::Client::RejectedExecutionError, Faraday::ConnectionFailed],
# }

@connection ||= Faraday.new(url) do |conn|
conn.response(:parse_json)
# Request compressed responses from ES and decompress them
Expand All @@ -155,7 +146,6 @@ def connection
conn.request(:opaque_id) if @opaque_id
conn.request(:limit_size, max_request_size: max_request_size) if max_request_size
conn.request(:elastomer_compress, compression: compression) if compress_body
#conn.request(:retry, retry_options)

conn.options[:timeout] = read_timeout
conn.options[:open_timeout] = open_timeout
Expand Down Expand Up @@ -258,7 +248,6 @@ def request(method, path, params)
body = extract_body(params)
path = expand_path(path, params)

params[:retries] = retries = 0
instrument(path, body, params) do
begin
response =
Expand Down
16 changes: 2 additions & 14 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,10 @@
ActiveSupport::Notifications.unsubscribe(@subscriber)
end

it "fails with 3 timeouts retries" do

it "does not retry GET requests" do
stub_request(:get, $client.url+"/_cat/indices").
to_timeout.then.
to_timeout.then
.to_timeout.then.
to_return({
headers: {"Content-Type" => "text/plain; charset=UTF-8"},
body: "green open test-index 1 0 0 0 159b 159b"
Expand All @@ -403,17 +402,6 @@
}
end

it "retries up to 2 times" do
stub_request(:get, $client.url+"/test-index/_settings").
to_timeout.then.
to_timeout.then.
to_return({body: %q/{"acknowledged": true}/})

response = $client.index("test-index").settings(max_retries: 2)

assert_equal({"acknowledged" => true}, response)
end

it "does not retry on PUT requests" do
stub_request(:put, $client.url+"/test-index").
to_timeout.then.
Expand Down

0 comments on commit 9f11b04

Please sign in to comment.