Skip to content

Commit

Permalink
🔧 Use client config for idle_response_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nevans committed Jun 10, 2024
1 parent 9eb9516 commit a769c25
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ class << self
def open_timeout; config.open_timeout end

# Seconds to wait until an IDLE response is received.
attr_reader :idle_response_timeout
def idle_response_timeout; config.idle_response_timeout end

# The hostname this client connected to
attr_reader :host
Expand Down Expand Up @@ -825,14 +825,13 @@ def open_timeout; config.open_timeout end
# config object for inheritance. Every Net::IMAP client has its own
# unique #config for overrides.
#
# [idle_response_timeout]
# Seconds to wait until an IDLE response is received
#
# Any other keyword arguments will be forwarded to Config.new, to create the
# client's #config. For example:
#
# [open_timeout]
# Seconds to wait until a connection is opened
# [idle_response_timeout]
# Seconds to wait until an IDLE response is received
#
# See DeprecatedClientOptions.new for deprecated arguments.
#
Expand Down Expand Up @@ -890,14 +889,12 @@ def open_timeout; config.open_timeout end
# Connected to the host successfully, but it immediately said goodbye.
#
def initialize(host, port: nil, ssl: nil,
idle_response_timeout: 5,
config: Config.global, **config_options)
super()
# Config options
@host = host
@config = Config.new(config, **config_options)
@port = port || (ssl ? SSL_PORT : PORT)
@idle_response_timeout = Integer(idle_response_timeout)
@ssl_ctx_params, @ssl_ctx = build_ssl_ctx(ssl)

# Basic Client State
Expand Down Expand Up @@ -2453,7 +2450,7 @@ def idle(timeout = nil, &response_handler)
unless @receiver_thread_terminating
remove_response_handler(response_handler)
put_string("DONE#{CRLF}")
response = get_tagged_response(tag, "IDLE", @idle_response_timeout)
response = get_tagged_response(tag, "IDLE", idle_response_timeout)
end
end
end
Expand Down

0 comments on commit a769c25

Please sign in to comment.