class Aptly::Configuration
Attributes
timeout[RW]
@!attribute timeout
The request read timeout in seconds. HTTP connections not responding in this time limit will raise an error. Note that the server-side API is currently synchronous so a read request may time out for no better reason than it not getting a suitable database lock in time, so allowing for some leeway is recommended here. https://github.com/smira/aptly/pull/459
@return [Integer] read timeout seconds
uri[RW]
@!attribute uri
Generally any suitable URI is allowed. This can also be a Unix domain socket which needs to be used in the notation unix:/tmp/sock.
@return [URI] the base URI for the API (localhost by default)
write_timeout[RW]
@!attribute write_timeout
The request write timeout in seconds. HTTP connections not responding in this time limit will raise an error. When pushing data into Aptly or publishing large repositories this value should be suitably high. This timeout is used for API calls which we expect to need a write-lock on the server. Using a value of a couple minutes is recommended if you have concurrent write requests (multiple uploads from different sources) or the server performance isn't always assured (slow disk, load spikes).
@return [Integer] write timeout seconds
Public Class Methods
new(uri: URI::HTTP.build(host: 'localhost', port: 80, path: '/'), timeout: [60, faraday_default_timeout].max, write_timeout: [10 * 60, timeout].max, host: nil, port: nil, path: nil)
click to toggle source
Creates a new instance. @param uri see {#uri} @param timeout see {#timeout} @param write_timeout
see {#write_timeout} @param host DEPRECATED use uri @param port DEPRECATED use uri @param path DEPRECATED use uri
# File lib/aptly/configuration.rb, line 60 def initialize(uri: URI::HTTP.build(host: 'localhost', port: 80, path: '/'), timeout: [60, faraday_default_timeout].max, write_timeout: [10 * 60, timeout].max, host: nil, port: nil, path: nil) @timeout = timeout @write_timeout = write_timeout @uri = nil @uri = uri unless host || port || path return if @uri @uri = fallback_uri(host, port, path) end
Private Instance Methods
fallback_uri(host, port, path)
click to toggle source
# File lib/aptly/configuration.rb, line 111 def fallback_uri(host, port, path) URI::HTTP.build(host: host || 'localhost', port: safe_port(port || 80), path: path || '/') end
faraday_default_timeout()
click to toggle source
# File lib/aptly/configuration.rb, line 103 def faraday_default_timeout Faraday.default_connection_options[:request][:timeout] || -1 end
safe_port(port)
click to toggle source
# File lib/aptly/configuration.rb, line 107 def safe_port(port) port ? port.to_i : port end