[CalendarServer-changes] [5244] CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav /scheduling/processing.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 4 10:44:44 PST 2010
Revision: 5244
http://trac.macosforge.org/projects/calendarserver/changeset/5244
Author: cdaboo at apple.com
Date: 2010-03-04 10:44:44 -0800 (Thu, 04 Mar 2010)
Log Message:
-----------
Fix auto-accept locking race condition.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/processing.py
Modified: CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/processing.py 2010-03-04 18:44:23 UTC (rev 5243)
+++ CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/processing.py 2010-03-04 18:44:44 UTC (rev 5244)
@@ -25,6 +25,7 @@
from twistedcaldav.ical import Property
from twistedcaldav.instance import InvalidOverriddenInstanceError
from twistedcaldav.log import Logger
+from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
from twistedcaldav.method import report_common
from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
from twistedcaldav.scheduling.itip import iTipProcessing, iTIPRequestStatus
@@ -410,6 +411,7 @@
returnValue(result)
+ @inlineCallbacks
def sendAttendeeAutoReply(self, calendar, resource, partstat):
"""
Auto-process the calendar option to generate automatic accept/decline status and
@@ -421,12 +423,28 @@
@return: L{Component} for the new calendar data to write
"""
- # Send out a reply
- log.debug("ImplicitProcessing - recipient '%s' processing UID: '%s' - auto-reply: %s" % (self.recipient.cuaddr, self.uid, partstat))
- from twistedcaldav.scheduling.implicit import ImplicitScheduler
- scheduler = ImplicitScheduler()
- scheduler.sendAttendeeReply(self.request, resource, calendar, self.recipient)
+ # We need to get the UID lock for implicit processing whilst we send the auto-reply
+ # as the Organizer processing will attempt to write out data to other attendees to
+ # refresh them. To prevent a race we need a lock.
+ lock = MemcacheLock("ImplicitUIDLock", calendar.resourceUID(), timeout=60.0)
+ try:
+ yield lock.acquire()
+
+ # Send out a reply
+ log.debug("ImplicitProcessing - recipient '%s' processing UID: '%s' - auto-reply: %s" % (self.recipient.cuaddr, self.uid, partstat))
+ from twistedcaldav.scheduling.implicit import ImplicitScheduler
+ scheduler = ImplicitScheduler()
+ yield scheduler.sendAttendeeReply(self.request, resource, calendar, self.recipient)
+
+ except MemcacheLockTimeoutError:
+
+ # Just try again to get the lock
+ reactor.callLater(2.0, self.sendAttendeeAutoReply, *(calendar, resource, partstat))
+
+ finally:
+ yield lock.clean()
+
@inlineCallbacks
def checkAttendeeAutoReply(self, calendar):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100304/2f94b2fc/attachment.html>
More information about the calendarserver-changes
mailing list