[CalendarServer-changes] [3492] CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/ directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 9 14:43:02 PST 2008


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

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

Modified: CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/directory/appleopendirectory.py	2008-12-09 21:30:18 UTC (rev 3491)
+++ CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/directory/appleopendirectory.py	2008-12-09 22:43:00 UTC (rev 3492)
@@ -459,17 +459,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
@@ -574,10 +576,14 @@
                 raise
 
     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/9c4b580d/attachment.html>


More information about the calendarserver-changes mailing list