[CalendarServer-changes] [9675] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:55:44 PDT 2012


Revision: 9675
          http://trac.macosforge.org/projects/calendarserver/changeset/9675
Author:   glyph at apple.com
Date:     2012-08-11 01:55:44 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
If the store is an SQL store, then hook it up to the SQL queue.  Otherwise leave the null queue in place.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/calendarserver/tap/caldav.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/q/calendarserver/tap/caldav.py	2012-08-11 08:55:43 UTC (rev 9674)
+++ CalendarServer/branches/users/glyph/q/calendarserver/tap/caldav.py	2012-08-11 08:55:44 UTC (rev 9675)
@@ -93,6 +93,7 @@
 
 from calendarserver.controlsocket import ControlSocketConnectingService
 from twisted.protocols.amp import AMP
+from twext.enterprise.queue import WorkerFactory as QueueWorkerFactory
 from calendarserver.accesslog import AMPCommonAccessLoggingObserver
 from calendarserver.accesslog import AMPLoggingFactory
 from calendarserver.accesslog import RotatingFileAccessLoggingObserver
@@ -125,6 +126,7 @@
 
 # Control socket message-routing constants.
 _LOG_ROUTE = "log"
+_QUEUE_ROUTE = "queue"
 
 _CONTROL_SERVICE_NAME = "control"
 
@@ -797,6 +799,14 @@
             f = Factory()
             f.protocol = LogClient
             controlSocketClient.addFactory(_LOG_ROUTE, f)
+            from txdav.common.datastore.sql import CommonDataStore as SQLStore
+            if isinstance(store, SQLStore):
+                from txdav.common.datastore.sql_tables import schema
+                def queueMasterAvailable(connectionFromMaster):
+                    store.queuer = connectionFromMaster
+                queueFactory = QueueWorkerFactory(store.newTransaction, schema,
+                                                  queueMasterAvailable)
+                controlSocketClient.addFactory(_QUEUE_ROUTE, queueFactory)
             controlClient = ControlSocketConnectingService(
                 endpointFactory, controlSocketClient
             )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/cecc6bca/attachment-0001.html>


More information about the calendarserver-changes mailing list