Skip to content
Browse files

Allow connect_timeout, read_timeout and write_timeout settings for My…

…SQL [#2544 state:resolved]

Signed-off-by: Pratik Naik <>
  • Loading branch information...
1 parent 80d8608 commit d3a802cee0f8cbe209af8886f8f8e8cab204d21a Matt Conway committed with lifo
Showing with 4 additions and 0 deletions.
  1. +4 −0 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
4 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -573,6 +573,10 @@ def connect
@connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher])
+ @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]
# reconnect must be set after real_connect is called, because real_connect sets it to false internally

0 comments on commit d3a802c

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