lib/mysql2/client.rb in mysql2-0.3.15 vs lib/mysql2/client.rb in mysql2-0.3.16

- old
+ new

@@ -21,10 +21,13 @@ @query_options = @@default_query_options.dup @query_options.merge! opts initialize_ext - [:reconnect, :connect_timeout, :local_infile, :read_timeout, :write_timeout, :default_file, :default_group, :secure_auth].each do |key| + # Set default connect_timeout to avoid unlimited retries from signal interruption + opts[:connect_timeout] = 120 unless opts.key?(:connect_timeout) + + [:reconnect, :connect_timeout, :local_infile, :read_timeout, :write_timeout, :default_file, :default_group, :secure_auth, :init_command].each do |key| next unless opts.key?(key) case key when :reconnect, :local_infile, :secure_auth send(:"#{key}=", !!opts[key]) when :connect_timeout, :read_timeout, :write_timeout