[CalendarServer-changes] [430] CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/ directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 10 14:40:54 PST 2006


Revision: 430
          http://trac.macosforge.org/projects/calendarserver/changeset/430
Author:   wsanchez at apple.com
Date:     2006-11-10 14:40:54 -0800 (Fri, 10 Nov 2006)

Log Message:
-----------
If results from the directory are empty, go ahead and return that, but
do not cache the result, so that we keep asking the directory for an
update. This should help with the case where we've lost our connection
to the directory by leaving us with a 5-minute cache of no data.

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py

Modified: CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py	2006-11-10 22:38:49 UTC (rev 429)
+++ CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py	2006-11-10 22:40:54 UTC (rev 430)
@@ -82,12 +82,14 @@
                         fullName = None,
                     )
 
-            self.records[recordType] = records
+            if records:
+                self.records[recordType] = records
+                reactor.callLater(recordListCacheTimeout, lambda: records.remove(recordType))
+            else:
+                # records is empty.  This may mean the directory went down.
+                # Don't cache this result, so that we keep checking the directory.
+                return records
 
-            def flushCache():
-                del(records[recordType])
-            reactor.callLater(recordListCacheTimeout, lambda: flushCache)
-
         return self.records[recordType]
 
     def listRecords(self, recordType):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061110/25b1b9a9/attachment.html


More information about the calendarserver-changes mailing list