[CalendarServer-changes] [3491] CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 9 13:30:18 PST 2008


Revision: 3491
          http://trac.macosforge.org/projects/calendarserver/changeset/3491
Author:   wsanchez at apple.com
Date:     2008-12-09 13:30:18 -0800 (Tue, 09 Dec 2008)
Log Message:
-----------
Clean up negative cache

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py

Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2008-12-09 19:39:01 UTC (rev 3490)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2008-12-09 21:30:18 UTC (rev 3491)
@@ -297,17 +297,19 @@
             for recordType in self.recordTypes():
                 # Check negative cache
                 if guid in self._storage(recordType)["disabled guids"]:
-                    break
+                    continue
 
                 self.reloadCache(recordType, guid=guid)
                 record = lookup()
-                if record is not None:
+
+                if record is None:
+                    self._storage(recordType)["disabled guids"].add(guid)
+                else:
                     self.log_info("Faulted record with GUID %s into %s record cache"
                                   % (guid, recordType))
                     break
             else:
                 # Nothing found; add to negative cache
-                self._storage(recordType)["disabled guids"].add(guid)
                 self.log_info("Unable to find any record with GUID %s" % (guid,))
 
         return record
@@ -414,10 +416,14 @@
 
 
     def reloadCache(self, recordType, shortName=None, guid=None):
-        if shortName:
-            self.log_info("Faulting record %s into %s record cache" % (shortName, recordType))
-        elif guid is None:
+        if shortName is not None:
+            self.log_info("Faulting record with shortName %s into %s record cache" % (shortName, recordType))
+        elif guid is not None:
+            self.log_info("Faulting record with guid %s into %s record cache" % (guid, recordType))
+        elif shortName is None and guid is None:
             self.log_info("Reloading %s record cache" % (recordType,))
+        else:
+            raise AssertionError("%r.reloadCache(%s, %s, %s)" % (self, recordType, shortName, guid))
 
         results = self._queryDirectory(recordType, shortName=shortName, guid=guid)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081209/caed3c4f/attachment-0001.html>


More information about the calendarserver-changes mailing list