Sha256: bfbb5f9f84411bd059f5e6e8ad8d7d60ac37b436925e111d0a4dc19f824a04d7

Contents?: true

Size: 418 Bytes

Versions: 8

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

class DHC::DefaultTimeout < DHC::Interceptor
  include ActiveSupport::Configurable

  config_accessor :timeout, :connecttimeout

  CONNECTTIMEOUT = 2 # seconds
  TIMEOUT = 15 # seconds

  def before_init
    request_options = (request.options || {})
    request_options[:timeout] ||= timeout || TIMEOUT
    request_options[:connecttimeout] ||= connecttimeout || CONNECTTIMEOUT
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dhc-2.4.0 lib/dhc/interceptors/default_timeout.rb
dhc-2.3.0 lib/dhc/interceptors/default_timeout.rb
dhc-2.2.1 lib/dhc/interceptors/default_timeout.rb
dhc-2.2.0 lib/dhc/interceptors/default_timeout.rb
dhc-2.1.1 lib/dhc/interceptors/default_timeout.rb
dhc-2.1.0 lib/dhc/interceptors/default_timeout.rb
dhc-2.0.1 lib/dhc/interceptors/default_timeout.rb
dhc-2.0.0 lib/dhc/interceptors/default_timeout.rb