make sure we always set wait_timeout even if a bad value was given

This commit is contained in:
Brian Lopez 2010-10-19 08:21:41 -07:00
parent e7dcf37bd4
commit 7e75f5ed4c

View File

@ -622,8 +622,9 @@ module ActiveRecord
variable_assignments << "NAMES '#{encoding}'" if encoding
# increase timeout so mysql server doesn't disconnect us
wait_timeout = @config[:wait_timeout] || 2592000
variable_assignments << "@@wait_timeout = #{wait_timeout}" if wait_timeout.is_a?(Fixnum)
wait_timeout = @config[:wait_timeout]
wait_timeout = 2592000 unless wait_timeout.is_a?(Fixnum)
variable_assignments << "@@wait_timeout = #{wait_timeout}"
execute("SET #{variable_assignments.join(', ')}", :skip_logging)
end