[CalendarServer-changes] [10955] CalendarServer/branches/users/sagen/testing/calendarserver/tap/ caldav.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 19 20:35:56 PDT 2013


Revision: 10955
          http://trac.calendarserver.org//changeset/10955
Author:   sagen at apple.com
Date:     2013-03-19 20:35:56 -0700 (Tue, 19 Mar 2013)
Log Message:
-----------
When running "./run -nt Single" spawn memcached so you don't have to launch it yourself.

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/testing/calendarserver/tap/caldav.py

Modified: CalendarServer/branches/users/sagen/testing/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/calendarserver/tap/caldav.py	2013-03-19 23:22:04 UTC (rev 10954)
+++ CalendarServer/branches/users/sagen/testing/calendarserver/tap/caldav.py	2013-03-20 03:35:56 UTC (rev 10955)
@@ -1003,11 +1003,35 @@
     def makeService_Single(self, options):
         """
         Create a service to be used in a single-process, stand-alone
-        configuration.
+        configuration.  Memcached will be spawned automatically.
         """
         def slaveSvcCreator(pool, store, logObserver):
             result = self.requestProcessingService(options, store, logObserver)
 
+            # Optionally launch memcached.  Note, this is not going through a
+            # ProcessMonitor because there is code elsewhere that needs to
+            # access memcached before startService() gets called, so we're just
+            # directly using Popen to spawn memcached.
+            for name, pool in config.Memcached.Pools.items():
+                if pool.ServerEnabled:
+                    self.log_info(
+                        "Adding memcached service for pool: %s" % (name,)
+                    )
+                    memcachedArgv = [
+                        config.Memcached.memcached,
+                        "-p", str(pool.Port),
+                        "-l", pool.BindAddress,
+                        "-U", "0",
+                    ]
+                    if config.Memcached.MaxMemory is not 0:
+                        memcachedArgv.extend(
+                            ["-m", str(config.Memcached.MaxMemory)]
+                        )
+                    if config.UserName:
+                        memcachedArgv.extend(["-u", config.UserName])
+                    memcachedArgv.extend(config.Memcached.Options)
+                    Popen(memcachedArgv)
+
             # Optionally set up push notifications
             pushDistributor = None
             if config.Notifications.Enabled:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130319/3eb1d94e/attachment.html>


More information about the calendarserver-changes mailing list