Skip to content

Commit

Permalink
Updated retry stage and change parameter reload_connections set false
Browse files Browse the repository at this point in the history
  • Loading branch information
OlehPalanskyi committed Jun 25, 2024
1 parent 6a4b186 commit 9e16cd4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/fluent/plugin/in_opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class UnrecoverableRequestFailure < Fluent::UnrecoverableError; end
config_param :repeat, :bool, :default => true
config_param :http_backend, :enum, list: [:excon, :typhoeus], :default => :excon
config_param :request_timeout, :time, :default => 5
config_param :reload_connections, :bool, :default => true
config_param :reload_connections, :bool, :default => false
config_param :reload_on_failure, :bool, :default => false
config_param :resurrect_after, :time, :default => 60
config_param :reload_after, :integer, :default => DEFAULT_RELOAD_AFTER
Expand Down Expand Up @@ -215,7 +215,7 @@ def reachable_host?(host)
host: ["#{host[:scheme]}://#{host[:host]}:#{host[:port]}"],
user: host[:user],
password: host[:password],
reload_connections: @reload_connections,
# reload_connections: @reload_connections,
request_timeout: @request_timeout,
resurrect_after: @resurrect_after,
reload_on_failure: @reload_on_failure,
Expand Down Expand Up @@ -343,14 +343,18 @@ def update_retry_state(error=nil)
@retry = retry_state(@retry_randomize)
end
@retry.step
if error.message.include?('EOFError (EOFError)')
log.error("Restart plugin #{error.message}")
exit(1)
end
#Raise error if the retry limit has been reached
raise "Hit limit for retries. retry_times: #{@retry.steps}, error: #{error.message}" if @retry.limit?
#Retry if the limit hasn't been reached
log.warn("failed to connect or search.", retry_times: @retry.steps, next_retry_time: @retry.next_time.round, error: error.message)
sleep(@retry.next_time - Time.now)
else
unless @retry.nil?
log.debug("retry succeeded.")
log.info("retry succeeded.")
@retry = nil
end
end
Expand Down

0 comments on commit 9e16cd4

Please sign in to comment.