Skip to content

Commit

Permalink
Add back correct retry delays
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Jan 29, 2025
1 parent 47adf63 commit 22bcac5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def build_keyword_arguments(plugins)
grouped = buffer.group_by { |name, _| name }
grouped.transform_values(&:count).find_all { |_, c| 1 < c }.each do |name,|
case name
when :endpoint, :endpoint_provider, :retry_limit, :retry_base_delay, :disable_s3_express_session_auth, :account_id, :account_id_endpoint_mode
when :endpoint, :endpoint_provider, :retry_backoff, :retry_limit, :retry_base_delay, :disable_s3_express_session_auth, :account_id, :account_id_endpoint_mode
# ok
else
warn("Duplicate client option in #{@service_name}: `#{grouped[name].map { |g| g.values_at(0, 2) }}`", uplevel: 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ module Aws
module DynamoDB
module Plugins
class ExtendedRetries < Seahorse::Client::Plugin
DEFAULT_BACKOFF = lambda do |c|
return if c.retries < 1

delay = 2**(c.retries - 1) * c.config.retry_base_delay
if (c.config.retry_max_delay || 0) > 0
delay = [delay, c.config.retry_max_delay].min
end
jitter = c.config.retry_jitter
jitter = JITTERS[jitter] if jitter.is_a?(Symbol)
delay = jitter.call(delay) if jitter
Kernel.sleep(delay)
end


option(
:retry_limit,
default: 10,
Expand All @@ -25,6 +39,15 @@ class ExtendedRetries < Seahorse::Client::Plugin
The base delay in seconds used by the default backoff function. This option
is only used in the `legacy` retry mode.
DOCS

option(
:retry_backoff,
default: DEFAULT_BACKOFF,
doc_type: Proc,
docstring: <<-DOCS)
A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
This option is only used in the `legacy` retry mode.
DOCS
end
end
end
Expand Down

0 comments on commit 22bcac5

Please sign in to comment.