Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9223: support_read_timeout_in_mysql.patch

File support_read_timeout_in_mysql.patch, 1.3 kB (added by seangeo, 1 year ago)
  • activerecord/lib/active_record/connection_adapters/mysql_adapter.rb

    old new  
    127127    # * <tt>:sslcert</tt> -- Necessary to use MySQL with an SSL connection 
    128128    # * <tt>:sslcapath</tt> -- Necessary to use MySQL with an SSL connection 
    129129    # * <tt>:sslcipher</tt> -- Necessary to use MySQL with an SSL connection 
     130    # * <tt>:read_timeout</tt> -- Socket Read Timeout in seconds. Defaults to no timeout. 
    130131    # 
    131132    # By default, the MysqlAdapter will consider all columns of type tinyint(1) 
    132133    # as boolean. If you wish to disable this emulation (which was the default 
     
    385386          if encoding 
    386387            @connection.options(Mysql::SET_CHARSET_NAME, encoding) rescue nil 
    387388          end 
     389          @connection.options(Mysql::OPT_READ_TIMEOUT, @config[:read_timeout]) if @config[:read_timeout] 
    388390          @connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher]) if @config[:sslkey] 
    389391          @connection.real_connect(*@connection_options) 
    390392          execute("SET NAMES '#{encoding}'") if encoding