Permalink
Browse files

Leaving only disconnect before starting transaction and reloading cla…

…sses, docs tweaks.
  • Loading branch information...
1 parent b5c6cd4 commit 9ee5aca48b2ba222d6879ad7a2376b043cbd1ba4 @pk committed May 4, 2009
Showing with 6 additions and 19 deletions.
  1. +6 −19 lib/merb_sequel.rb
View
@@ -6,9 +6,8 @@
# Connects to the database and handles session
#
- # Connects to the database
- # Handels sessions
- # Sets router to identify models using Model.pk
+ # Connects to the database and loads sequel sessions if we use them.
+ # Sets router to identify models using Model.pk.
class Merb::Orms::Sequel::Connect < Merb::BootLoader
after BeforeAppLoads
@@ -24,25 +23,13 @@ def self.run
end
- # Disconnects from the database before forking worker
- #
- # TODO: Make sure this is needed or not buggy
- class Merb::Orms::Sequel::DisconnectBeforeFork < Merb::BootLoader
- after AfterAppLoads
-
- def self.run
- Merb.logger.debug "Disconnecting database connection before forking."
- ::Sequel::DATABASES.each { |db| db.disconnect }
- end
-
- end
-
# Disconnects from DB before starting reloading classes
#
- # There is a problem with the pg gem driver wich causes infinite loop duing
- # reloading process.
+ # There is a problem with the pg gem driver wich causes infinite loop
+ # duing reloading process.
#
- # Disconnect is one not in testing and if we use reloading classes.
+ # Disconnect only when fork_for_class_relaod is set and we're not in
+ # testing mode.
class Merb::BootLoader::DisconnectBeforeStartTransaction < Merb::BootLoader
before LoadClasses

1 comment on commit 9ee5aca

This change seems to introduce a regression of this bug:

https://merb.lighthouseapp.com/projects/7588/tickets/196-patch-merb_sequel-should-drop-any-active-connections-before-forking

Was there a reason to remove the DisconnectBeforeFork code? Something like it is necessary to avoid freaky issues with db connection sockets getting shared between different forked processes...

Please sign in to comment.