[Jifty-commit] r5767 - in jifty/trunk: lib lib/Jifty/Server lib/Jifty/Server/Fork lib/Jifty/Server/Prefork
Jifty commits
jifty-commit at lists.jifty.org
Mon Aug 25 20:09:10 EDT 2008
Author: alexmv
Date: Mon Aug 25 20:09:08 2008
New Revision: 5767
Added:
jifty/trunk/lib/Jifty/Server/Fork/
jifty/trunk/lib/Jifty/Server/Fork/NetServer.pm
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty.pm
jifty/trunk/lib/Jifty/Server/Fork.pm
jifty/trunk/lib/Jifty/Server/Prefork/NetServer.pm
Log:
r36484 at kohr-ah: chmrr | 2008-08-25 20:08:37 -0400
* When we set up database connections, first purge the memcache
connections, if any. Reusing memcache filehandles leads to Hate.
* After we fork in the server, re-set up the database connections.
You might notice these two points are related...
Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm (original)
+++ jifty/trunk/lib/Jifty.pm Mon Aug 25 20:09:08 2008
@@ -492,6 +492,10 @@
Jifty->handle( $handle_class->new );
Jifty->handle->connect();
+ # Clean out any stale Cache::Memcached connections
+ $Jifty::DBI::Record::Memcached::MEMCACHED->disconnect_all
+ if $Jifty::DBI::Record::Memcached::MEMCACHED;
+
# Make sure the app version matches the database version
Jifty->handle->check_schema_version()
unless $args{'no_version_check'};
Modified: jifty/trunk/lib/Jifty/Server/Fork.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Server/Fork.pm (original)
+++ jifty/trunk/lib/Jifty/Server/Fork.pm Mon Aug 25 20:09:08 2008
@@ -23,6 +23,6 @@
=cut
-sub net_server { 'Net::Server::Fork' }
+sub net_server { 'Jifty::Server::Fork::NetServer' }
1;
Added: jifty/trunk/lib/Jifty/Server/Fork/NetServer.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/lib/Jifty/Server/Fork/NetServer.pm Mon Aug 25 20:09:08 2008
@@ -0,0 +1,22 @@
+package Jifty::Server::Fork::NetServer;
+
+use base 'Net::Server::Fork';
+
+=head1 NAME
+
+Jifty::Server::Fork::NetServer - Sets up children for Jifty::Server::Fork
+
+=head1 METHODS
+
+=head2 post_accept_hook
+
+After forking every connection, resetup the database connections so we
+don't share them with our parent.
+
+=cut
+
+sub post_accept_hook {
+ Jifty->setup_database_connection();
+}
+
+1;
Modified: jifty/trunk/lib/Jifty/Server/Prefork/NetServer.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Server/Prefork/NetServer.pm (original)
+++ jifty/trunk/lib/Jifty/Server/Prefork/NetServer.pm Mon Aug 25 20:09:08 2008
@@ -15,7 +15,7 @@
=cut
sub child_init_hook {
- Jifty->setup_database_connection();
+ Jifty->setup_database_connection();
}
1;
More information about the Jifty-commit
mailing list