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

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 29 14:20:52 PDT 2010


Revision: 6487
          http://trac.macosforge.org/projects/calendarserver/changeset/6487
Author:   sagen at apple.com
Date:     2010-10-29 14:20:50 -0700 (Fri, 29 Oct 2010)
Log Message:
-----------
Retry 2 more times when we see -14987 ds error

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

Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2010-10-29 20:45:26 UTC (rev 6486)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2010-10-29 21:20:50 UTC (rev 6487)
@@ -613,18 +613,10 @@
                 raise UnknownRecordTypeError("Unknown OpenDirectory record type: %s" % (recordType))
 
 
-            try:
-                self.log_debug("opendirectory.queryRecordsWithAttribute_list(%r,%r,%r,%r,%r,%r,%r)" % (
-                    self.directory,
-                    query.attribute,
-                    query.value,
-                    query.matchType,
-                    caseInsensitive,
-                    listRecordTypes,
-                    attrs,
-                ))
-                results.extend(
-                    lookupMethod(
+            # Because we're getting transient OD error -14987, try 3 times:
+            for i in xrange(3):
+                try:
+                    self.log_debug("opendirectory.queryRecordsWithAttribute_list(%r,%r,%r,%r,%r,%r,%r)" % (
                         self.directory,
                         query.attribute,
                         query.value,
@@ -632,16 +624,32 @@
                         caseInsensitive,
                         listRecordTypes,
                         attrs,
+                    ))
+                    results.extend(
+                        lookupMethod(
+                            self.directory,
+                            query.attribute,
+                            query.value,
+                            query.matchType,
+                            caseInsensitive,
+                            listRecordTypes,
+                            attrs,
+                        )
                     )
-                )
 
-            except opendirectory.ODError, ex:
-                if ex.message[1] == -14140 or ex.message[1] == -14200:
-                    # Unsupported attribute on record - don't fail
-                    return
+                except opendirectory.ODError, ex:
+                    if ex.message[1] == -14987:
+                        # Fall through and retry
+                        self.log_error("OpenDirectory (node=%s) error: %s" % (self.realmName, str(ex)))
+                    elif ex.message[1] == -14140 or ex.message[1] == -14200:
+                        # Unsupported attribute on record - don't fail
+                        return
+                    else:
+                        self.log_error("OpenDirectory (node=%s) error: %s" % (self.realmName, str(ex)))
+                        raise
                 else:
-                    self.log_error("OpenDirectory (node=%s) error: %s" % (self.realmName, str(ex)))
-                    raise
+                    # Success, so break the retry loop
+                    break
 
         self.log_debug("opendirectory.queryRecordsWithAttribute_list matched records: %s" % (len(results),))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101029/8ee4b004/attachment-0001.html>


More information about the calendarserver-changes mailing list