aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMatt Conway <wr0ngway@yahoo.com>2009-04-22 22:25:46 -0400
committerPratik Naik <pratiknaik@gmail.com>2009-08-09 17:13:22 +0100
commit1c9b3aabdd1ff1e5b0e2b9bf6d5149baf6f23d1b (patch)
tree467a55ed0c128cd5769b55323d9c68ded6122803 /activerecord
parent076ca48bd649ddea4dd1a320879c03a9fe7a0a6d (diff)
downloadrails-1c9b3aabdd1ff1e5b0e2b9bf6d5149baf6f23d1b.tar.gz
rails-1c9b3aabdd1ff1e5b0e2b9bf6d5149baf6f23d1b.tar.bz2
rails-1c9b3aabdd1ff1e5b0e2b9bf6d5149baf6f23d1b.zip
Allow connect_timeout, read_timeout and write_timeout settings for MySQL [#2544 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 83cb9cff15..2b882a1f25 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -587,6 +587,10 @@ module ActiveRecord
@connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher])
end
+ @connection.options(Mysql::OPT_CONNECT_TIMEOUT, @config[:connect_timeout]) if @config[:connect_timeout]
+ @connection.options(Mysql::OPT_READ_TIMEOUT, @config[:read_timeout]) if @config[:read_timeout]
+ @connection.options(Mysql::OPT_WRITE_TIMEOUT, @config[:write_timeout]) if @config[:write_timeout]
+
@connection.real_connect(*@connection_options)
# reconnect must be set after real_connect is called, because real_connect sets it to false internally