Skip to content
This repository
Browse code

Allow connect_timeout, read_timeout and write_timeout settings for My…

…SQL [#2544 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 1c9b3aabdd1ff1e5b0e2b9bf6d5149baf6f23d1b 1 parent 076ca48
Matt Conway authored April 22, 2009 lifo committed August 09, 2009
4  activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -587,6 +587,10 @@ def connect
587 587
             @connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher])
588 588
           end
589 589
 
  590
+          @connection.options(Mysql::OPT_CONNECT_TIMEOUT, @config[:connect_timeout]) if @config[:connect_timeout]
  591
+          @connection.options(Mysql::OPT_READ_TIMEOUT, @config[:read_timeout]) if @config[:read_timeout]
  592
+          @connection.options(Mysql::OPT_WRITE_TIMEOUT, @config[:write_timeout]) if @config[:write_timeout]
  593
+
590 594
           @connection.real_connect(*@connection_options)
591 595
 
592 596
           # reconnect must be set after real_connect is called, because real_connect sets it to false internally

0 notes on commit 1c9b3aa

Please sign in to comment.
Something went wrong with that request. Please try again.