diff options
author | Edgars Beigarts <edgars.beigarts@tieto.com> | 2010-06-22 11:48:11 +0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-22 21:48:43 +0200 |
commit | 62c4e4d3856b38ee9869f4ad6342e712788c8635 (patch) | |
tree | 76dd8517ea2dbd4ddedb0772a9e157efa35d1280 | |
parent | c0fc084e937ff045a75227cee52c801589517435 (diff) | |
download | rails-62c4e4d3856b38ee9869f4ad6342e712788c8635.tar.gz rails-62c4e4d3856b38ee9869f4ad6342e712788c8635.tar.bz2 rails-62c4e4d3856b38ee9869f4ad6342e712788c8635.zip |
Fix connection reloading in development mode. [#4929 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 979ed52f4a..c2d79a421d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -144,7 +144,9 @@ module ActiveRecord @connections.each do |conn| conn.disconnect! if conn.requires_reloading? end - @connections = [] + @connections.delete_if do |conn| + conn.requires_reloading? + end end # Verify active connections and remove and disconnect connections diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 4ee9fee4a9..4567539566 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -142,9 +142,10 @@ module ActiveRecord # this should be overridden by concrete adapters end - # Returns true if its safe to reload the connection between requests for development mode. + # Returns true if its required to reload the connection between requests for development mode. + # This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite. def requires_reloading? - true + false end # Checks whether the connection to the database is still active (i.e. not stale). |