Skip to content

Commit 53591ca

Browse files
committed
Add a default connect_timeout option of 2 minutes.
1 parent 58f3f3a commit 53591ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/mysql2/client.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def initialize(opts = {})
2323

2424
initialize_ext
2525

26+
# Set default connect_timeout to avoid unlimited retries from signal interruption
27+
opts[:connect_timeout] = 120 unless opts.key?(:connect_timeout)
28+
2629
[:reconnect, :connect_timeout, :local_infile, :read_timeout, :write_timeout, :default_file, :default_group, :secure_auth, :init_command].each do |key|
2730
next unless opts.key?(key)
2831
case key

0 commit comments

Comments
 (0)