Class: Async::Aws::Handler

Inherits:
Seahorse::Client::Handler
  • Object
show all
Defined in:
lib/async/aws/handler.rb

Defined Under Namespace

Classes: StreamingBody, TruncatedBodyError

Constant Summary collapse

NETWORK_ERRORS =
[
  Async::TimeoutError,
  SocketError,
  EOFError,
  IOError,
  Errno::ECONNREFUSED,
  Errno::ECONNRESET,
  Errno::EPIPE,
  Errno::ETIMEDOUT,
  Errno::EADDRNOTAVAIL,
  Errno::ENETDOWN,
  Errno::ENOBUFS,
  Errno::EHOSTUNREACH,
  Errno::ENETUNREACH,
  Errno::ENOTCONN,
  OpenSSL::SSL::SSLError,
  Protocol::HTTP::Error,
].tap do |errors|
  if defined?(Async::HTTP::ConnectionError)
    errors << Async::HTTP::ConnectionError
  end
  if defined?(Protocol::HTTP2::Error)
    errors << Protocol::HTTP2::Error
  end
  if defined?(Protocol::HTTP2)
    errors << Protocol::HTTP2::GoawayError if Protocol::HTTP2.const_defined?(:GoawayError)
    errors << Protocol::HTTP2::StreamError if Protocol::HTTP2.const_defined?(:StreamError)
  end
end.freeze
DNS_ERROR_PATTERNS =
[
  /getaddrinfo/i,
  /nodename nor servname/i,
  /name or service not known/i,
  /host not found/i,
  /temporary failure in name resolution/i,
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler = nil, client_cache: nil) ⇒ void

Parameters:

  • handler (Seahorse::Client::Handler, nil) (defaults to: nil)
  • client_cache (Async::Aws::ClientCache, nil) (defaults to: nil)


168
169
170
171
172
173
174
# File 'lib/async/aws/handler.rb', line 168

def initialize(handler = nil, client_cache: nil)
  super(handler)
  @client_cache = client_cache || ClientCache.new
  @fallback_mutex = Mutex.new
  @invalid_fallback_warned = {}
  @invalid_streaming_warned = {}
end

Class Method Details

.log_transport_once(kind, logger) ⇒ void

This method returns an undefined value.

Parameters:

  • kind (Symbol)
  • logger (Logger, nil)


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/async/aws/handler.rb', line 23

def log_transport_once(kind, logger)
  return unless kind == :async_http

  @transport_mutex.synchronize do
    return if @transport_logged[kind]

    @transport_logged[kind] = true
  end

  logger&.info('[aws-sdk-http-async] using async-http transport')
end

Instance Method Details

#call(context) ⇒ Seahorse::Client::Response

Parameters:

  • context (Seahorse::Client::RequestContext)

Returns:

  • (Seahorse::Client::Response)


178
179
180
181
182
183
184
185
186
187
188
# File 'lib/async/aws/handler.rb', line 178

def call(context)
  if event_stream_operation?(context)
    ensure_reactor!
    return delegate_event_stream(context)
  end

  return force_net_http(context) if force_fallback?
  return fallback_handler(context) unless async_context?

  call_with_reactor(context)
end