[CalendarServer-changes] [14967] CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav /datastore/scheduling/imip
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 15 08:16:58 PDT 2015
Revision: 14967
http://trac.calendarserver.org//changeset/14967
Author: cdaboo at apple.com
Date: 2015-07-15 08:16:58 -0700 (Wed, 15 Jul 2015)
Log Message:
-----------
Handle iMIP/IMAP race condition in multi-pod mode.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py
CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py
Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py 2015-07-15 15:13:38 UTC (rev 14966)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py 2015-07-15 15:16:58 UTC (rev 14967)
@@ -624,7 +624,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/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py 2015-07-15 15:13:38 UTC (rev 14966)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py 2015-07-15 15:16:58 UTC (rev 14967)
@@ -60,7 +60,14 @@
module = getModule(__name__)
self.dataPath = module.filePath.sibling("data")
+ self.wp = None
+ self.store.queuer.callWithNewProposals(self._proposalCallback)
+
+ def _proposalCallback(self, wp):
+ self.wp = wp
+
+
def dataFile(self, name):
"""
Get the contents of a given data file from the 'data/mail' test
@@ -183,6 +190,7 @@
calBody = template % token
result = (yield self.receiver.processDSN(calBody, "xyzzy"))
self.assertEquals(result, MailReceiver.INJECTION_SUBMITTED)
+ yield self.wp.whenExecuted()
@inlineCallbacks
@@ -205,6 +213,7 @@
result = (yield self.receiver.processReply(msg))
self.assertEquals(result, MailReceiver.INJECTION_SUBMITTED)
+ yield self.wp.whenExecuted()
def test_processReplyMissingOrganizer(self):
@@ -436,7 +445,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/e5389f56/attachment.html>
More information about the calendarserver-changes
mailing list