[CalendarServer-changes] [6602] CalendarServer/branches/users/glyph/dont-start-postgres/ calendarserver/tap/caldav.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 10 18:54:51 PST 2010


Revision: 6602
          http://trac.macosforge.org/projects/calendarserver/changeset/6602
Author:   glyph at apple.com
Date:     2010-11-10 18:54:47 -0800 (Wed, 10 Nov 2010)
Log Message:
-----------
Move slave startup all the way to the end of the service construction.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py

Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py	2010-11-11 02:54:36 UTC (rev 6601)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py	2010-11-11 02:54:47 UTC (rev 6602)
@@ -842,18 +842,6 @@
                 monitor.addProcess('memcached-%s' % (name,), memcachedArgv,
                                    env=PARENT_ENVIRONMENT)
 
-        ssvc = self.storageService(monitor, uid, gid)
-        ssvc.setServiceParent(s)
-
-        if isinstance(ssvc, PostgresService):
-            # TODO: better way of doing this conditional.  Look at the config
-            # again, possibly?
-            pool = ConnectionPool(ssvc.produceConnection)
-            pool.setServiceParent(s)
-            dispenser = ConnectionDispenser(pool)
-        else:
-            dispenser = None
-
         #
         # Calculate the number of processes to spawn
         #
@@ -908,12 +896,8 @@
                         sock = _openSocket(bindAddress, int(portNum))
                         inheritSSLFDs.append(sock.fileno())
 
-        self.addSlaveProcesses(
-            monitor, dispenser, cl.dispatcher, options["config"],
-            inheritFDs=inheritFDs, inheritSSLFDs=inheritSSLFDs
-        )
-
-
+        # Start listening on the stats socket, for administrators to inspect
+        # the current stats on the server.
         stats = CalDAVStatisticsServer(logger)
         statsService = GroupOwnedUNIXServer(
             gid, config.GlobalStatsSocket, stats, mode=0440
@@ -921,6 +905,30 @@
         statsService.setName("stats")
         statsService.setServiceParent(s)
 
+        # Finally, let's get the real show on the road.  Create a service that
+        # will spawn all of our worker processes when started, and wrap that
+        # service in zero to two necessary layers before it's started: first,
+        # the service which spawns a subsidiary database (if that's necessary,
+        # and we don't have an external, already-running database to connect
+        # to), and second, the service which does an upgrade from the
+        # filesystem to the database (if that's necessary, and there is
+        # filesystem data in need of upgrading).
+        ssvc = self.storageService(monitor, uid, gid)
+        ssvc.setServiceParent(s)
+
+        if isinstance(ssvc, PostgresService):
+            # TODO: better way of doing this conditional.  Look at the config
+            # again, possibly?
+            pool = ConnectionPool(ssvc.produceConnection)
+            pool.setServiceParent(s)
+            dispenser = ConnectionDispenser(pool)
+        else:
+            dispenser = None
+
+        self.addSlaveProcesses(
+            monitor, dispenser, cl.dispatcher, options["config"],
+            inheritFDs=inheritFDs, inheritSSLFDs=inheritSSLFDs
+        )
         return s
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101110/1bd2ba1c/attachment.html>


More information about the calendarserver-changes mailing list