Skip to content

Commit a972bf8

Browse files
committed
🔧 Use client config for idle_response_timeout
1 parent d9fdfbe commit a972bf8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/net/imap.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ class << self
778778
def open_timeout; config.open_timeout end
779779

780780
# Seconds to wait until an IDLE response is received.
781-
attr_reader :idle_response_timeout
781+
def idle_response_timeout; config.idle_response_timeout end
782782

783783
# The hostname this client connected to
784784
attr_reader :host
@@ -825,14 +825,13 @@ def open_timeout; config.open_timeout end
825825
# config object for inheritance. Every Net::IMAP client has its own
826826
# unique #config for overrides.
827827
#
828-
# [idle_response_timeout]
829-
# Seconds to wait until an IDLE response is received
830-
#
831828
# Any other keyword arguments will be forwarded to Config.new, to create the
832829
# client's #config. For example:
833830
#
834831
# [open_timeout]
835832
# Seconds to wait until a connection is opened
833+
# [idle_response_timeout]
834+
# Seconds to wait until an IDLE response is received
836835
#
837836
# See DeprecatedClientOptions.new for deprecated arguments.
838837
#
@@ -890,14 +889,12 @@ def open_timeout; config.open_timeout end
890889
# Connected to the host successfully, but it immediately said goodbye.
891890
#
892891
def initialize(host, port: nil, ssl: nil,
893-
idle_response_timeout: 5,
894892
config: Config.global, **config_options)
895893
super()
896894
# Config options
897895
@host = host
898896
@config = Config.new(config, **config_options)
899897
@port = port || (ssl ? SSL_PORT : PORT)
900-
@idle_response_timeout = Integer(idle_response_timeout)
901898
@ssl_ctx_params, @ssl_ctx = build_ssl_ctx(ssl)
902899

903900
# Basic Client State
@@ -2453,7 +2450,7 @@ def idle(timeout = nil, &response_handler)
24532450
unless @receiver_thread_terminating
24542451
remove_response_handler(response_handler)
24552452
put_string("DONE#{CRLF}")
2456-
response = get_tagged_response(tag, "IDLE", @idle_response_timeout)
2453+
response = get_tagged_response(tag, "IDLE", idle_response_timeout)
24572454
end
24582455
end
24592456
end

0 commit comments

Comments
 (0)