Skip to content

Commit

Permalink
make connect_timeout work with DNS resolution
Browse files Browse the repository at this point in the history
Before it could timeout connection process, but still wait for DNS
resolution for long time. It's possible to interrupt addrinfo in ruby 3+
  • Loading branch information
haukot committed Jul 16, 2024
1 parent a715e05 commit 9436af9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webpacker/dev_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(config)

def running?
if config.dev_server.present?
Socket.tcp(host, port, connect_timeout: connect_timeout).close
Timeout.timeout(connect_timeout) { Socket.tcp(host, port).close }
true
else
false
Expand Down
1 change: 1 addition & 0 deletions lib/webpacker/dev_server_runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "shellwords"
require "socket"
require "timeout"
require "webpacker/configuration"
require "webpacker/dev_server"
require "webpacker/runner"
Expand Down

0 comments on commit 9436af9

Please sign in to comment.