[CalendarServer-changes] [5303] CalendarServer/trunk/calendarserver/tap

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 12 14:35:07 PST 2010


Revision: 5303
          http://trac.macosforge.org/projects/calendarserver/changeset/5303
Author:   sagen at apple.com
Date:     2010-03-12 14:35:06 -0800 (Fri, 12 Mar 2010)
Log Message:
-----------
Only call loader.updateProxyDB( ) -- which is only used for testing -- in the master process.  If it's done in all the processes, they'll race for it.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/calendarserver/tap/util.py

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2010-03-12 22:33:59 UTC (rev 5302)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2010-03-12 22:35:06 UTC (rev 5303)
@@ -38,7 +38,7 @@
 from twisted.python.log import FileLogObserver
 from twisted.python.usage import Options, UsageError
 from twisted.plugin import IPlugin
-from twisted.internet.reactor import callLater, spawnProcess
+from twisted.internet.reactor import callLater, spawnProcess, addSystemEventTrigger
 from twisted.internet.process import ProcessExitedAlready
 from twisted.internet.protocol import Protocol, Factory
 from twisted.application.internet import TCPServer, UNIXServer
@@ -63,6 +63,7 @@
 from twistedcaldav.config import ConfigurationError
 from twistedcaldav.config import config
 from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
+from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
 from twistedcaldav.localization import processLocalizationFiles
 from twistedcaldav.mail import IMIPReplyInboxResource
 from twistedcaldav.static import CalendarHomeProvisioningFile
@@ -426,18 +427,29 @@
 
             if config.ProcessType in ('Combined', 'Single'):
 
+                # Memcached is not needed for this process
+                config.Memcached.Pools.Default.ClientEnabled = False
+
+                # Note: if the master process ever needs access to memcached
+                # we'll either have to start memcached prior to the
+                # updateProxyDB call below, or disable memcached
+                # client config only while updateProxyDB is running.
+
                 # Process localization string files
                 processLocalizationFiles(config.Localization)
 
                 # Now do any on disk upgrades we might need.
-                # Memcache isn't running at this point, so temporarily change
-                # the config so nobody tries to talk to it while upgrading
-                memcacheSetting = config.Memcached.Pools.Default.ClientEnabled
-                config.Memcached.Pools.Default.ClientEnabled = False
                 upgradeData(config)
-                config.Memcached.Pools.Default.ClientEnabled = memcacheSetting
 
+                # Make sure proxies get initialized
+                if config.ProxyLoadFromFile:
+                    def _doProxyUpdate():
+                        loader = XMLCalendarUserProxyLoader(config.ProxyLoadFromFile)
+                        return loader.updateProxyDB()
+                    addSystemEventTrigger("after", "startup", _doProxyUpdate)
 
+
+
             service = serviceMethod(options)
 
             #

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2010-03-12 22:33:59 UTC (rev 5302)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2010-03-12 22:35:06 UTC (rev 5303)
@@ -38,7 +38,6 @@
 from twistedcaldav import memcachepool
 from twistedcaldav.directory import augment, calendaruserproxy
 from twistedcaldav.directory.aggregate import AggregateDirectoryService
-from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
 from twistedcaldav.directory.digest import QopDigestCredentialFactory
 from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
 from twistedcaldav.directory.sudo import SudoDirectoryService
@@ -180,16 +179,6 @@
         raise
 
     #
-    # Make sure proxies get initialized
-    #
-    if config.ProxyLoadFromFile:
-        def _doProxyUpdate():
-            loader = XMLCalendarUserProxyLoader(config.ProxyLoadFromFile)
-            return loader.updateProxyDB()
-
-        reactor.addSystemEventTrigger("after", "startup", _doProxyUpdate)
-
-    #
     # Configure Memcached Client Pool
     #
     memcachepool.installPools(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100312/4fe50982/attachment.html>


More information about the calendarserver-changes mailing list