[CalendarServer-changes] [1520] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue May 8 17:52:38 PDT 2007
Revision: 1520
http://trac.macosforge.org/projects/calendarserver/changeset/1520
Author: cdaboo at apple.com
Date: 2007-05-08 17:52:38 -0700 (Tue, 08 May 2007)
Log Message:
-----------
Initialize the index in MKCALENDAR so subsequent simulataneous PUTs will not cause a race-condition to initialize
the index.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/index.py
CalendarServer/trunk/twistedcaldav/static.py
CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py
Modified: CalendarServer/trunk/twistedcaldav/index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/index.py 2007-05-08 20:25:09 UTC (rev 1519)
+++ CalendarServer/trunk/twistedcaldav/index.py 2007-05-09 00:52:38 UTC (rev 1520)
@@ -95,6 +95,12 @@
"""
self.resource = resource
+ def create(self):
+ """
+ Create the index and initialize it.
+ """
+ self._db()
+
def reserveUID(self, uid):
"""
Reserve a UID for this index's resource.
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2007-05-08 20:25:09 UTC (rev 1519)
+++ CalendarServer/trunk/twistedcaldav/static.py 2007-05-09 00:52:38 UTC (rev 1520)
@@ -132,6 +132,10 @@
# Initialize CTag on the calendar collection
self.writeDeadProperty(customxml.GETCTag(str(datetime.datetime.now())))
+
+ # Create the index so its ready when the first PUTs come in
+ self.index().create()
+
return status
d = self.createSpecialCollection(davxml.ResourceType.calendar)
Modified: CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py 2007-05-08 20:25:09 UTC (rev 1519)
+++ CalendarServer/trunk/twistedcaldav/test/test_mkcalendar.py 2007-05-09 00:52:38 UTC (rev 1520)
@@ -17,6 +17,7 @@
##
from twisted.internet.defer import waitForDeferred
from twisted.internet.defer import deferredGenerator
+from twistedcaldav import index
import os
@@ -63,6 +64,9 @@
self.fail("Incorrect response to successful MKCALENDAR: %s"
% (response.code,))
+ if not os.path.exists(os.path.join(path, index.db_basename)):
+ self.fail("Did not create index file when creating a calendar")
+
request = SimpleRequest(self.site, "MKCALENDAR", uri)
return self.send(request, do_test)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070508/f6921a8d/attachment.html
More information about the calendarserver-changes
mailing list