Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/patches.rb
Overview
see activerecord/lib/active_record/connection_adaptors/abstract/connection_specification.rb
Class Method Summary collapse
-
.clear_reloadable_connections! ⇒ Object
monkey patch to fix threading problems, see: dev.rubyonrails.org/ticket/7579.
- .spawn_reconnect(klass = self) ⇒ Object
Class Method Details
.clear_reloadable_connections! ⇒ Object
monkey patch to fix threading problems, see: dev.rubyonrails.org/ticket/7579
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/patches.rb', line 34 def self.clear_reloadable_connections! if @@allow_concurrency # Hash keyed by thread_id in @@active_connections. Hash of hashes. @@active_connections.each do |thread_id, conns| conns.each do |name, conn| if conn.requires_reloading? conn.disconnect! @@active_connections[thread_id].delete(name) end end end else # Just one level hash, no concurrency. @@active_connections.each do |name, conn| if conn.requires_reloading? conn.disconnect! @@active_connections.delete(name) end end end end |
.spawn_reconnect(klass = self) ⇒ Object
6 7 8 |
# File 'lib/patches.rb', line 6 def self.spawn_reconnect(klass=self) ActiveRecord::Base.connection.reconnect! end |