Skip to content

Commit

Permalink
avoid garbage collection of parent connection handlers which can mess…
Browse files Browse the repository at this point in the history
… with the database connection in the parent process
  • Loading branch information
tra committed Nov 24, 2009
1 parent 844238b commit 2295e93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class ActiveRecord::Base
# reconnect without disconnecting
if Spawn::RAILS_2_2
def self.spawn_reconnect(klass=self)
# keep ancestors' connection_handlers around to avoid them being garbage collected
(@@ancestor_connection_handlers ||= []) << @@connection_handler
@@connection_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
establish_connection
end
Expand Down

0 comments on commit 2295e93

Please sign in to comment.