[Jifty-commit] r6957 - jifty/trunk/lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Fri May 8 01:52:44 EDT 2009


Author: alexmv
Date: Fri May  8 01:52:43 2009
New Revision: 6957

Modified:
   jifty/trunk/lib/Jifty/Server.pm
   jifty/trunk/lib/Jifty/TestServer.pm

Log:
Fix another shared database handle between tests and test servers

Tests shared a database handle with their spawned test servers, which
amazongly mostly never bit us, except when requests finished very
quickly.  Ensure that the test script gets a new database handle after
spasning the test server.

Modified: jifty/trunk/lib/Jifty/Server.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Server.pm	(original)
+++ jifty/trunk/lib/Jifty/Server.pm	Fri May  8 01:52:43 2009
@@ -166,5 +166,22 @@
     }
 }
 
+=head2 started_ok
+
+After starting, ensure we have a different database socket from the
+server.
+
+=cut
+
+sub started_ok {
+    my $self = shift;
+    my $ret = $self->SUPER::started_ok(@_);
+    if ($ret) {
+        Jifty->handle->dbh->{InactiveDestroy} = 1;
+        Jifty->setup_database_connection;
+    }
+    return $ret;
+}
+
 1;
 

Modified: jifty/trunk/lib/Jifty/TestServer.pm
==============================================================================
--- jifty/trunk/lib/Jifty/TestServer.pm	(original)
+++ jifty/trunk/lib/Jifty/TestServer.pm	Fri May  8 01:52:43 2009
@@ -60,15 +60,7 @@
         return "http://localhost:".$self->port;
     } else {
         Jifty->handle->dbh->{'InactiveDestroy'} = 1;
-        Jifty->handle->dbh(undef);
-        # See DBI.pm: 
-        #
-        # This attribute is specifically designed for use in Unix applications
-        # that "fork" child processes. Either the parent or the child process,
-        # but not both, should set C<InactiveDestroy> true on all their shared handles.
-        # (Note that some databases, including Oracle, don't support passing a
-        # database connection across a fork.)
-        #
+        Jifty->setup_database_connection;
     }
 
     require POSIX;


More information about the Jifty-commit mailing list