[CalendarServer-changes] [14966] CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 15 08:13:38 PDT 2015


Revision: 14966
          http://trac.calendarserver.org//changeset/14966
Author:   cdaboo at apple.com
Date:     2015-07-15 08:13:38 -0700 (Wed, 15 Jul 2015)
Log Message:
-----------
Handle iMIP/IMAP race condition in multi-pod mode.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py	2015-07-15 04:16:14 UTC (rev 14965)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py	2015-07-15 15:13:38 UTC (rev 14966)
@@ -690,7 +690,7 @@
         self.log.debug("IMAP in cbGotMessage")
         try:
             messageData = results.values()[0]['RFC822']
-        except IndexError:
+        except (IndexError, KeyError):
             # results will be empty unless the "twistedmail-imap-flags-anywhere"
             # patch from http://twistedmatrix.com/trac/ticket/1105 is applied
             self.log.error("Skipping empty results -- apply twisted patch!")

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py	2015-07-15 04:16:14 UTC (rev 14965)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py	2015-07-15 15:13:38 UTC (rev 14966)
@@ -457,7 +457,34 @@
         self.assertEquals(self.flagDeletedResult, "xyzzy")
 
 
+    @inlineCallbacks
+    def test_missingIMAPMessages(self):
+        """
+        Make sure L{IMAP4DownloadProtocol.cbGotMessage} can deal with missing messages.
+        """
 
+        class DummyResult(object):
+            def __init__(self):
+                self._values = []
+
+            def values(self):
+                return self._values
+
+        noResult = DummyResult()
+        missingKey = DummyResult()
+        missingKey.values().append({})
+
+        imap4 = IMAP4DownloadProtocol()
+        imap4.messageUIDs = []
+        imap4.fetchNextMessage = lambda : None
+
+        result = yield imap4.cbGotMessage(noResult, [])
+        self.assertTrue(result is None)
+        result = yield imap4.cbGotMessage(missingKey, [])
+        self.assertTrue(result is None)
+
+
+
 class StubFactory(object):
 
     def __init__(self, actionTaken, deleteAllMail):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150715/78044472/attachment-0001.html>


More information about the calendarserver-changes mailing list