[CalendarServer-changes] [11554] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 24 08:52:48 PDT 2013


Revision: 11554
          http://trac.calendarserver.org//changeset/11554
Author:   cdaboo at apple.com
Date:     2013-07-24 08:52:48 -0700 (Wed, 24 Jul 2013)
Log Message:
-----------
Add an option to suppress attendee refreshes when the total attendee count exceeds a configurable threshold (defaults to 50).

Modified Paths:
--------------
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_pocessing.py

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2013-07-24 04:23:15 UTC (rev 11553)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2013-07-24 15:52:48 UTC (rev 11554)
@@ -773,6 +773,8 @@
         <false/>
         <key>AttendeeRefreshBatch</key>
         <integer>0</integer>
+        <key>AttendeeRefreshCountLimit</key>
+        <integer>50</integer>
 
 		<key>AutoSchedule</key>
 		<dict>

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-07-24 04:23:15 UTC (rev 11553)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-07-24 15:52:48 UTC (rev 11554)
@@ -711,6 +711,7 @@
             "AttendeeRefreshBatch"                : 5, # Number of attendees to do batched refreshes: 0 - no batching
             "AttendeeRefreshBatchDelaySeconds"    : 5, # Time after an iTIP REPLY for first batched attendee refresh
             "AttendeeRefreshBatchIntervalSeconds" : 5, # Time between attendee batch refreshes
+            "AttendeeRefreshCountLimit"           : 50, # Number of attendees above which attendee refreshes are suppressed: 0 - no limit
             "UIDLockTimeoutSeconds"               : 60, # Time for implicit UID lock timeout
             "UIDLockExpirySeconds"                : 300, # Expiration time for UID lock,
             "PrincipalHostAliases"                : [], # Host names matched in http(s) CUAs

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2013-07-24 04:23:15 UTC (rev 11553)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2013-07-24 15:52:48 UTC (rev 11554)
@@ -234,7 +234,9 @@
             # and only if the request does not indicate we should skip attendee refresh
             # (e.g. inbox item processing during migration from non-implicit server)
             if partstatChanged and not self.noAttendeeRefresh:
-                yield self.queueAttendeeUpdate((attendeeReplying, organizer,))
+                # Check limit of attendees
+                if config.Scheduling.Options.AttendeeRefreshCountLimit == 0 or len(self.recipient_calendar.getAllUniqueAttendees()) <= config.Scheduling.Options.AttendeeRefreshCountLimit:
+                    yield self.queueAttendeeUpdate((attendeeReplying, organizer,))
 
             result = (True, False, True, changes,)
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_pocessing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_pocessing.py	2013-07-24 04:23:15 UTC (rev 11553)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_pocessing.py	2013-07-24 15:52:48 UTC (rev 11554)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, succeed
 from twisted.trial import unittest
 
 from twistedcaldav import memcacher
@@ -22,6 +22,7 @@
 from twistedcaldav.stdconfig import config
 
 from txdav.caldav.datastore.scheduling.processing import ImplicitProcessor
+from txdav.caldav.datastore.scheduling.cuaddress import LocalCalendarUser
 
 
 class FakeImplicitProcessor(ImplicitProcessor):
@@ -37,7 +38,11 @@
         self.batches += 1
 
 
+    def writeCalendarResource(self, collection, resource, calendar):
+        return succeed(FakeResource())
 
+
+
 class FakePrincipal(object):
 
     def __init__(self, cuaddr):
@@ -49,6 +54,25 @@
 
 
 
+class FakeResource(object):
+
+    def parentCollection(self):
+        return self
+
+
+    def ownerHome(self):
+        return self
+
+
+    def uid(self):
+        return None
+
+
+    def id(self):
+        return None
+
+
+
 class BatchRefresh (unittest.TestCase):
     """
     iCalendar support tests
@@ -113,3 +137,96 @@
         processor.recipient_calendar = calendar
         yield processor.queueAttendeeUpdate(("urn:uuid:user02", "urn:uuid:user01",))
         self.assertEqual(processor.batches, 1)
+
+
+    @inlineCallbacks
+    def test_queueAttendeeUpdate_count_suppressed(self):
+
+        self.patch(config.Scheduling.Options, "AttendeeRefreshCountLimit", 5)
+        self.patch(config.Scheduling.Options, "AttendeeRefreshBatch", 5)
+
+        calendar_small = Component.fromString("""BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER:urn:uuid:user01
+ATTENDEE:urn:uuid:user01
+ATTENDEE:urn:uuid:user02
+ATTENDEE:urn:uuid:user03
+ATTENDEE:urn:uuid:user04
+END:VEVENT
+END:VCALENDAR
+""")
+        itip_small = Component.fromString("""BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER:urn:uuid:user01
+ATTENDEE;PARTSTAT="ACCEPTED":urn:uuid:user02
+END:VEVENT
+END:VCALENDAR
+""")
+        calendar_large = Component.fromString("""BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER:urn:uuid:user01
+ATTENDEE:urn:uuid:user01
+ATTENDEE:urn:uuid:user02
+ATTENDEE:urn:uuid:user03
+ATTENDEE:urn:uuid:user04
+ATTENDEE:urn:uuid:user05
+ATTENDEE:urn:uuid:user06
+ATTENDEE:urn:uuid:user07
+ATTENDEE:urn:uuid:user08
+ATTENDEE:urn:uuid:user09
+ATTENDEE:urn:uuid:user10
+END:VEVENT
+END:VCALENDAR
+""")
+        itip_large = Component.fromString("""BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER:urn:uuid:user01
+ATTENDEE;PARTSTAT="ACCEPTED":urn:uuid:user02
+END:VEVENT
+END:VCALENDAR
+""")
+
+        for count, calendar, itip, result, msg in (
+            (5, calendar_small, itip_small, 1, "Small, count=5"),
+            (5, calendar_large, itip_large, 0, "Large, count=5"),
+            (0, calendar_small, itip_small, 1, "Small, count=0"),
+            (0, calendar_large, itip_large, 1, "Large, count=0"),
+        ):
+            config.Scheduling.Options.AttendeeRefreshCountLimit = count
+            processor = FakeImplicitProcessor()
+            processor.txn = ""
+            processor.recipient_calendar = calendar.duplicate()
+            processor.uid = processor.recipient_calendar.newUID()
+            processor.recipient_calendar_resource = None
+            processor.message = itip.duplicate()
+            processor.message.newUID(processor.uid)
+            processor.originator = LocalCalendarUser(None, None)
+            processor.recipient = LocalCalendarUser(None, None)
+            processor.uid = calendar.resourceUID()
+            processor.noAttendeeRefresh = False
+
+            processed = yield processor.doImplicitOrganizerUpdate()
+            self.assertTrue(processed[3] is not None, msg=msg)
+            self.assertEqual(processor.batches, result, msg=msg)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130724/31918622/attachment.html>


More information about the calendarserver-changes mailing list