[CalendarServer-changes] [2579] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 17 14:59:34 PDT 2008


Revision: 2579
          http://trac.macosforge.org/projects/calendarserver/changeset/2579
Author:   dreid at apple.com
Date:     2008-06-17 14:59:33 -0700 (Tue, 17 Jun 2008)

Log Message:
-----------
Add UIDReservationTimeOut option to the config file.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/index.py
    CalendarServer/trunk/twistedcaldav/test/test_index.py

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-06-17 21:25:53 UTC (rev 2578)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-06-17 21:59:33 UTC (rev 2579)
@@ -226,6 +226,7 @@
 
     "EnableKeepAlive": True,
     "IdleConnectionTimeOut": 15,
+    "UIDReservationTimeOut": 30 * 60
 }
 
 

Modified: CalendarServer/trunk/twistedcaldav/index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/index.py	2008-06-17 21:25:53 UTC (rev 2578)
+++ CalendarServer/trunk/twistedcaldav/index.py	2008-06-17 21:59:33 UTC (rev 2579)
@@ -57,8 +57,6 @@
 schema_version = "6"
 collection_types = {"Calendar": "Regular Calendar Collection", "iTIP": "iTIP Calendar Collection"}
 
-reservation_timeout_secs = 5 * 60
-
 #
 # Duration into the future through which recurrances are expanded in the index
 # by default.  This is a caching parameter which affects the size of the index;
@@ -476,7 +474,7 @@
 
         d = self.getCachePool().add(self._key(uid),
                                     'reserved',
-                                    expireTime=reservation_timeout_secs)
+                                    expireTime=config.UIDReservationTimeOut)
         d.addCallback(_handleFalse)
         return d
 
@@ -585,7 +583,7 @@
             # otherwise we probably have a stale reservation
             tm = time.strptime(attime[:19], "%Y-%m-%d %H:%M:%S")
             dt = datetime.datetime(year=tm.tm_year, month=tm.tm_mon, day=tm.tm_mday, hour=tm.tm_hour, minute=tm.tm_min, second = tm.tm_sec)
-            if datetime.datetime.now() - dt > datetime.timedelta(seconds=reservation_timeout_secs):
+            if datetime.datetime.now() - dt > datetime.timedelta(seconds=config.UIDReservationTimeOut):
                 try:
                     self.index._db_execute("delete from RESERVED where UID = :1", uid)
                     self.index._db_commit()

Modified: CalendarServer/trunk/twistedcaldav/test/test_index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_index.py	2008-06-17 21:25:53 UTC (rev 2578)
+++ CalendarServer/trunk/twistedcaldav/test/test_index.py	2008-06-17 21:59:33 UTC (rev 2579)
@@ -69,11 +69,12 @@
         # WARNING: This test is fundamentally flawed and will fail
         # intermittently because it uses the real clock.
         uid = "test-test-test"
-        old_timeout = twistedcaldav.index.reservation_timeout_secs
-        twistedcaldav.index.reservation_timeout_secs = 1
+        from twistedcaldav.config import config
+        old_timeout = config.UIDReservationTimeOut
+        config.UIDReservationTimeOut = 1
 
         def _finally(result):
-            twistedcaldav.index.reservation_timeout_secs = old_timeout
+            config.UIDReservationTimeOut = old_timeout
             return result
 
         d = self.db.isReservedUID(uid)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080617/16099139/attachment-0001.htm 


More information about the calendarserver-changes mailing list