From 7e75f5ed4c21920684c842850e4d74072cda2054 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Tue, 19 Oct 2010 08:21:41 -0700 Subject: [PATCH] make sure we always set wait_timeout even if a bad value was given --- lib/active_record/connection_adapters/mysql2_adapter.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index c72c3c4..828e948 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -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