Skip to content

Commit 9440723

Browse files
committed
🔧 Use client config for idle_response_timeout
1 parent 0e2b94f commit 9440723

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
@@ -776,7 +776,7 @@ class << self
776776
def open_timeout; config.open_timeout end
777777

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

781781
# The hostname this client connected to
782782
attr_reader :host
@@ -823,14 +823,13 @@ def open_timeout; config.open_timeout end
823823
# config object for inheritance. Every Net::IMAP client has its own
824824
# unique #config for overrides.
825825
#
826-
# [idle_response_timeout]
827-
# Seconds to wait until an IDLE response is received
828-
#
829826
# Any other keyword arguments will be forwarded to Config.new, to create the
830827
# client's #config. For example:
831828
#
832829
# [open_timeout]
833830
# Seconds to wait until a connection is opened
831+
# [idle_response_timeout]
832+
# Seconds to wait until an IDLE response is received
834833
#
835834
# See DeprecatedClientOptions.new for deprecated arguments.
836835
#
@@ -888,14 +887,12 @@ def open_timeout; config.open_timeout end
888887
# Connected to the host successfully, but it immediately said goodbye.
889888
#
890889
def initialize(host, port: nil, ssl: nil,
891-
idle_response_timeout: 5,
892890
config: Config.global, **config_options)
893891
super()
894892
# Config options
895893
@host = host
896894
@config = Config.new(config, **config_options)
897895
@port = port || (ssl ? SSL_PORT : PORT)
898-
@idle_response_timeout = Integer(idle_response_timeout)
899896
@ssl_ctx_params, @ssl_ctx = build_ssl_ctx(ssl)
900897

901898
# Basic Client State
@@ -2451,7 +2448,7 @@ def idle(timeout = nil, &response_handler)
24512448
unless @receiver_thread_terminating
24522449
remove_response_handler(response_handler)
24532450
put_string("DONE#{CRLF}")
2454-
response = get_tagged_response(tag, "IDLE", @idle_response_timeout)
2451+
response = get_tagged_response(tag, "IDLE", idle_response_timeout)
24552452
end
24562453
end
24572454
end

0 commit comments

Comments
 (0)