Skip to content

Conversation

Copy link

Copilot AI commented Dec 10, 2025

Users experiencing Net::ReadTimeout errors have no way to configure timeout values. The RestClient initialization uses implicit defaults with no override mechanism.

Changes

  • Added timeout configuration to Client.new: Accepts optional read_timeout (response wait time) and open_timeout (connection wait time) parameters via options hash
  • Set explicit defaults: Both timeouts default to 60 seconds
  • Maintained backward compatibility: Existing initialization calls work unchanged

Usage

# Use defaults (60s each)
client = Improvmx::Client.new('api-key')

# Configure for slow networks
client = Improvmx::Client.new('api-key', {
  read_timeout: 120,
  open_timeout: 30
})

Implementation

Modified lib/improvmx/client.rb to pass timeout and open_timeout to RestClient::Resource. Added tests covering default and custom timeout scenarios.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.improvmx.com
    • Triggering command: /usr/bin/ruby3.2 ruby3.2 /home/REDACTED/work/ruby-improvmx/ruby-improvmx/vendor/bundle/ruby/3.2.0/bin/rspec --format documentation -I/u�� _64-linux-gnu/ru-I 131907615+lodewiges@users.noreply.github.com> by-3.2.0 /tmp/ccBAVWg3.s kward (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Net::ReadTimeout: Net::ReadTimeout with #TCPSocket:(closed) (Net::ReadTimeout)
from net/protocol.rb:229:in 'rbuf_fill'
from net/protocol.rb:199:in 'readuntil'
from net/protocol.rb:209:in 'readline'
from net/smtp.rb:1017:in 'recv_response'
from net/smtp.rb:979:in 'block in data'
from net/smtp.rb:1027:in 'critical'
from net/smtp.rb:965:in 'data'
from net/smtp.rb:799:in 'block in send_message'
from net/smtp.rb:926:in 'rcptto_list'
from net/smtp.rb:799:in 'send_message'
from mail/network/delivery_methods/smtp_connection.rb:53:in 'deliver!'
from mail/network/delivery_methods/smtp.rb:109:in 'block in deliver!'
from net/smtp.rb:643:in 'start'
from mail/network/delivery_methods/smtp.rb:154:in 'start_smtp_session'
from mail/network/delivery_methods/smtp.rb:108:in 'deliver!'
from mail/message.rb:2148:in 'do_delivery'
from mail/message.rb:253:in 'block in deliver'
from action_mailer/base.rb:595:in 'block in deliver_mail'
from active_support/notifications.rb:212:in 'instrument'
from action_mailer/base.rb:593:in 'deliver_mail'
from mail/message.rb:253:in 'deliver'
from action_mailer/message_delivery.rb:126:in 'block (2 levels) in deliver_now'
from active_support/callbacks.rb:101:in 'run_callbacks'
from action_mailer/message_delivery.rb:125:in 'block in deliver_now'
from action_mailer/rescuable.rb:21:in 'handle_exceptions'
from action_mailer/message_delivery.rb:124:in 'deliver_now'
from action_mailer/mail_delivery_job.rb:28:in 'perform'
from active_job/execution.rb:68:in 'block in _perform_job'
from active_support/callbacks.rb:121:in 'block in run_callbacks'
from i18n.rb:353:in 'with_locale'
from active_job/translation.rb:9:in 'block (2 levels) in module:Translation'
from active_support/callbacks.rb:130:in 'instance_exec'
from active_support/callbacks.rb:130:in 'block in run_callbacks'
from active_support/core_ext/time/zones.rb:65:in 'use_zone'
from active_job/timezones.rb:9:in 'block (2 levels) in module:Timezones'
from active_support/callbacks.rb:130:in 'instance_exec'
from active_support/callbacks.rb:130:in 'block in run_callbacks'
from active_support/callbacks.rb:141:in 'run_callbacks'
from active_job/execution.rb:67:in '_perform_job'
from active_job/instrumentation.rb:32:in '_perform_job'
from active_job/execution.rb:51:in 'perform_now'
from active_job/instrumentation.rb:26:in 'block in perform_now'
from active_record/railties/job_runtime.rb:13:in 'block in instrument'
from active_job/instrumentation.rb:40:in 'block in instrument'
from active_support/notifications.rb:210:in 'block in instrument'
from active_support/notifications/instrumenter.rb:58:in 'instrument'
from active_support/notifications.rb:210:in 'instrument'
from active_job/instrumentation.rb:39:in 'instrument'
from active_record/railties/job_runtime.rb:11:in 'instrument'
from active_job/instrumentation.rb:26:in 'perform_now'
from active_job/logging.rb:32:in 'block in perform_now'
from active_support/tagged_logging.rb:138:in 'block in tagged'
from active_support/tagged_logging.rb:38:in 'tagged'
from active_support/tagged_logging.rb:138:in 'tagged'
from active_support/broadcast_logger.rb:228:in 'method_missing'
from active_job/logging.rb:39:in 'tag_logger'
from active_job/logging.rb:32:in 'perform_now'
from sentry/rails/active_job.rb:10:in 'perform_now'
from active_job/execution.rb:29:in 'block in execute'
from active_support/callbacks.rb:121:in 'block in run_callbacks'
from active_job/railtie.rb:79:in 'block (4 levels) in class:Railtie'
from active_support/reloader.rb:77:in 'block in wrap'
from active_support/execution_wrapper.rb:87:in 'wrap'
from active_support/reloader.rb:74:in 'wrap'
from active_job/railtie.rb:78:in 'block (3 levels) in class:Railtie'
from active_support/callbacks.rb:130:in 'instance_exec'
from active_support/callbacks.rb:130:in 'block in run_callbacks'
from active_support/callbacks.rb:141:in 'run_callbacks'
from active_job/execution.rb:27:in 'execute'
from active_job/queue_adapters/sidekiq_adapter.rb:14:in 'perform'
from sidekiq/processor.rb:227:in 'execute_job'
from sidekiq/processor.rb:192:in 'block (4 levels) in process'
from sidekiq/middleware/chain.rb:180:in 'traverse'
from sidekiq/middleware/chain.rb:183:in 'block in traverse'
from sentry/sidekiq/sentry_context_middleware.rb:69:in 'call'
from sidekiq/middleware/chain.rb:182:in 'traverse'
from sidekiq/middleware/chain.rb:183:in 'block in traverse'
from sidekiq/job/interrupt_handler.rb:9:in 'call'
from sidekiq/middleware/chain.rb:182:in 'traverse'
from sidekiq/middleware/chain.rb:183:in 'block in traverse'
from sidekiq/metrics/tracking.rb:26:in 'track'
from sidekiq/...

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 10, 2025 18:19
Co-authored-by: lodewiges <131907615+lodewiges@users.noreply.github.com>
Co-authored-by: lodewiges <131907615+lodewiges@users.noreply.github.com>
Co-authored-by: lodewiges <131907615+lodewiges@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Net::ReadTimeout in SMTP delivery Add configurable timeout options to RestClient Dec 10, 2025
Copilot AI requested a review from lodewiges December 10, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants