<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[15647] CalendarServer/trunk/contrib/performance/loadtest</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/15647">15647</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2016-06-02 09:41:06 -0700 (Thu, 02 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sim fixes:
- subscribes to push notifications for shared-to-me calendars
- guards against re-entry due to multiple push notifications
- adds a random start time to the looping calls so they're not all in lock step
- adds client/instance information to user-agent
- always syncs the calendar home when a push arrives</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcontribperformanceloadtestclientsplist">CalendarServer/trunk/contrib/performance/loadtest/clients.plist</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestconfigplist">CalendarServer/trunk/contrib/performance/loadtest/config.plist</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtesticalpy">CalendarServer/trunk/contrib/performance/loadtest/ical.py</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestpopulationpy">CalendarServer/trunk/contrib/performance/loadtest/population.py</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestprofilespy">CalendarServer/trunk/contrib/performance/loadtest/profiles.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcontribperformanceloadtestclientsplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/clients.plist (15646 => 15647)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2016-06-01 15:01:12 UTC (rev 15646)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2016-06-02 16:41:06 UTC (rev 15647)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">                                 &lt;dict&gt;
</span><span class="cx">                                         &lt;!-- Name that appears in logs. --&gt;
</span><span class="cx">                                         &lt;key&gt;title&lt;/key&gt;
</span><del>-                                        &lt;string&gt;10.11a&lt;/string&gt;
</del><ins>+                                        &lt;string&gt;main&lt;/string&gt;
</ins><span class="cx"> 
</span><span class="cx">                                         &lt;!-- OS_X_10_11 can poll the calendar home at some interval. This is
</span><span class="cx">                                                 in seconds. --&gt;
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will use
</span><span class="cx">                                                                 its client to create a new event. --&gt;
</span><span class="cx">                                                         &lt;key&gt;interval&lt;/key&gt;
</span><del>-                                                        &lt;integer&gt;120&lt;/integer&gt;
</del><ins>+                                                        &lt;integer&gt;180&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                         &lt;!-- Define how start times (DTSTART) for the randomly generated events
</span><span class="cx">                                                                 will be selected. This is an example of a &quot;Distribution&quot; parameter. The value
</span><span class="lines">@@ -315,7 +315,7 @@
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will use
</span><span class="cx">                                                                 its client to create a new event. --&gt;
</span><span class="cx">                                                         &lt;key&gt;interval&lt;/key&gt;
</span><del>-                                                        &lt;integer&gt;120&lt;/integer&gt;
</del><ins>+                                                        &lt;integer&gt;60&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                 &lt;/dict&gt;
</span><span class="cx">                                         &lt;/dict&gt;
</span><span class="lines">@@ -333,7 +333,7 @@
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will use
</span><span class="cx">                                                                 its client to create a new event. --&gt;
</span><span class="cx">                                                         &lt;key&gt;interval&lt;/key&gt;
</span><del>-                                                        &lt;integer&gt;120&lt;/integer&gt;
</del><ins>+                                                        &lt;integer&gt;60&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                         &lt;!-- Define the description length distribution. --&gt;
</span><span class="cx">                                                         &lt;key&gt;descriptionLengthDistribution&lt;/key&gt;
</span><span class="lines">@@ -427,7 +427,7 @@
</span><span class="cx"> 
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will share calendars. --&gt;
</span><span class="cx">                                                         &lt;key&gt;interval&lt;/key&gt;
</span><del>-                                                        &lt;integer&gt;300&lt;/integer&gt;
</del><ins>+                                                        &lt;integer&gt;1800&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                 &lt;/dict&gt;
</span><span class="cx">                                         &lt;/dict&gt;
</span><span class="lines">@@ -451,7 +451,7 @@
</span><span class="cx">                                                                 &lt;dict&gt;
</span><span class="cx">                                                                         &lt;!-- mu gives the mean of the normal distribution (in seconds). --&gt;
</span><span class="cx">                                                                         &lt;key&gt;mu&lt;/key&gt;
</span><del>-                                                                        &lt;integer&gt;120&lt;/integer&gt;
</del><ins>+                                                                        &lt;integer&gt;720&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                                         &lt;!-- and sigma gives its standard deviation. --&gt;
</span><span class="cx">                                                                         &lt;key&gt;sigma&lt;/key&gt;
</span><span class="lines">@@ -515,6 +515,10 @@
</span><span class="cx">                                                                 &lt;/dict&gt;
</span><span class="cx">                                                         &lt;/dict&gt;
</span><span class="cx"> 
</span><ins>+                                                        &lt;!-- Percentage of time to do a lookup for invitee --&gt;
+                                                        &lt;key&gt;inviteeLookupPercentage&lt;/key&gt;
+                                                        &lt;integer&gt;50&lt;/integer&gt;
+
</ins><span class="cx">                                                         &lt;!-- Define how start times (DTSTART) for the randomly generated events
</span><span class="cx">                                                                 will be selected. This is an example of a &quot;Distribution&quot; parameter. The value
</span><span class="cx">                                                                 for most &quot;Distribution&quot; parameters are interchangeable and extensible. --&gt;
</span><span class="lines">@@ -765,7 +769,7 @@
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will use
</span><span class="cx">                                                                 its client to refresh. --&gt;
</span><span class="cx">                                                         &lt;key&gt;interval&lt;/key&gt;
</span><del>-                                                        &lt;integer&gt;600&lt;/integer&gt;
</del><ins>+                                                        &lt;integer&gt;1800&lt;/integer&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                 &lt;/dict&gt;
</span><span class="cx">                                         &lt;/dict&gt;
</span><span class="lines">@@ -807,7 +811,7 @@
</span><span class="cx">                                 &lt;dict&gt;
</span><span class="cx">                                         &lt;!-- Name that appears in logs. --&gt;
</span><span class="cx">                                         &lt;key&gt;title&lt;/key&gt;
</span><del>-                                        &lt;string&gt;10.11b&lt;/string&gt;
</del><ins>+                                        &lt;string&gt;idle&lt;/string&gt;
</ins><span class="cx"> 
</span><span class="cx">                                         &lt;!-- OS_X_10_11 can poll the calendar home at some interval. This is
</span><span class="cx">                                                 in seconds. --&gt;
</span><span class="lines">@@ -845,7 +849,7 @@
</span><span class="cx">                                 &lt;!-- Determine the frequency at which this client configuration will
</span><span class="cx">                                         appear in the clients which are created by the load tester. --&gt;
</span><span class="cx">                                 &lt;key&gt;weight&lt;/key&gt;
</span><del>-                                &lt;integer&gt;2&lt;/integer&gt;
</del><ins>+                                &lt;integer&gt;6&lt;/integer&gt;
</ins><span class="cx">                         &lt;/dict&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;/array&gt;
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestconfigplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist (15646 => 15647)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/config.plist        2016-06-01 15:01:12 UTC (rev 15646)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist        2016-06-02 16:41:06 UTC (rev 15647)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">                                 &lt;!-- Number of clients each user is assigned to. --&gt;
</span><span class="cx">                                 &lt;!-- Set weight of clients to 1 if this is &gt; 1. Number of clients must match this value if &gt; 1. --&gt;
</span><span class="cx">                                 &lt;key&gt;clientsPerUser&lt;/key&gt;
</span><del>-                                &lt;integer&gt;3&lt;/integer&gt;
</del><ins>+                                &lt;integer&gt;7&lt;/integer&gt;
</ins><span class="cx">                         &lt;/dict&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;/dict&gt;
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtesticalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py (15646 => 15647)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/ical.py        2016-06-01 15:01:12 UTC (rev 15646)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py        2016-06-02 16:41:06 UTC (rev 15647)
</span><span class="lines">@@ -509,6 +509,7 @@
</span><span class="cx">         serializePath,
</span><span class="cx">         record,
</span><span class="cx">         auth,
</span><ins>+        instanceNumber,
</ins><span class="cx">         title=None,
</span><span class="cx">         calendarHomePollInterval=None,
</span><span class="cx">         supportPush=True,
</span><span class="lines">@@ -516,6 +517,7 @@
</span><span class="cx">     ):
</span><span class="cx"> 
</span><span class="cx">         self._client_id = str(uuid4())
</span><ins>+        self._instanceNumber = instanceNumber
</ins><span class="cx"> 
</span><span class="cx">         self.reactor = reactor
</span><span class="cx"> 
</span><span class="lines">@@ -580,7 +582,10 @@
</span><span class="cx">         self.xmpp = {}
</span><span class="cx"> 
</span><span class="cx">         self.ampPushKeys = {}
</span><ins>+        self.subscribedAmpPushKeys = set()
</ins><span class="cx"> 
</span><ins>+        self._busyWithPush = False
+
</ins><span class="cx">         # Keep track of push factories so we can unsubscribe at shutdown
</span><span class="cx">         self._pushFactories = []
</span><span class="cx"> 
</span><span class="lines">@@ -599,7 +604,11 @@
</span><span class="cx">         Default is to add User-Agent, sub-classes should override to add other
</span><span class="cx">         client specific things, Accept etc.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        headers.setRawHeaders('User-Agent', [self.USER_AGENT])
</del><ins>+        headers.setRawHeaders(
+            'User-Agent', [&quot;{} {} {}&quot;.format(
+                self.USER_AGENT, self.title, self._instanceNumber
+            )]
+        )
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="lines">@@ -1017,6 +1026,17 @@
</span><span class="cx">                     sharedByMe=isSharedByMe
</span><span class="cx">                 ))
</span><span class="cx"> 
</span><ins>+                # Also monitor shared-to-me calendars
+                if isShared and not isSharedByMe:
+                    try:
+                        pushkey = textProps[csxml.pushkey]
+                    except KeyError:
+                        pass
+                    else:
+                        if pushkey:
+                            self.ampPushKeys[href] = pushkey
+
+
</ins><span class="cx">             elif isNotifications:
</span><span class="cx">                 textProps = results[href].getTextProperties()
</span><span class="cx">                 notificationCollection = NotificationCollection(
</span><span class="lines">@@ -1436,6 +1456,9 @@
</span><span class="cx">         if firstTime:
</span><span class="cx">             yield self._pollFirstTime2()
</span><span class="cx"> 
</span><ins>+        pushKeys = self.ampPushKeys.values()
+        self._monitorAmpPush(calendarHomeSet, pushKeys)
+
</ins><span class="cx">         returnValue(True)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1580,23 +1603,39 @@
</span><span class="cx">         connect(GAIEndpoint(self.reactor, host, port), factory)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
+    @inlineCallbacks
</ins><span class="cx">     def _receivedPush(self, inboundID, dataChangedTimestamp, priority=5):
</span><del>-        for href, myId in self.ampPushKeys.iteritems():
-            if inboundID == myId:
-                self._checkCalendarsForEvents(href, push=True)
-                break
-        else:
-            # somehow we are not subscribed to this id
-            pass
</del><ins>+        if not self._busyWithPush:
+            self._busyWithPush = True
+            try:
+                for href, myId in self.ampPushKeys.iteritems():
+                    if inboundID == myId:
+                        yield self._checkCalendarsForEvents(self.calendarHomeHref, push=True)
+                        break
+                else:
+                    # somehow we are not subscribed to this id
+                    pass
+            finally:
+                self._busyWithPush = False
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _monitorAmpPush(self, home, pushKeys):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Start monitoring for AMP-based push notifications
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        AMPHub.subscribeToIDs(pushKeys, self._receivedPush)
</del><span class="cx"> 
</span><ins>+        # Only subscribe to keys we haven't previously subscribed to
+        subscribeTo = []
+        for pushKey in pushKeys:
+            if pushKey not in self.subscribedAmpPushKeys:
+                subscribeTo.append(pushKey)
+                self.subscribedAmpPushKeys.add(pushKey)
</ins><span class="cx"> 
</span><ins>+        if subscribeTo:
+            AMPHub.subscribeToIDs(subscribeTo, self._receivedPush)
+
+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def _unsubscribePubSub(self):
</span><span class="cx">         for factory in self._pushFactories:
</span><span class="lines">@@ -1950,7 +1989,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><del>-    def addInvite(self, href, component, attachmentSize=0):
</del><ins>+    def addInvite(self, href, component, attachmentSize=0, lookupPercentage=100):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Add an event that is an invite - i.e., has attendees. We will do attendee lookups and freebusy
</span><span class="cx">         checks on each attendee to simulate what happens when an organizer creates a new invite.
</span><span class="lines">@@ -1961,7 +2000,9 @@
</span><span class="cx">         for attendee in attendees:
</span><span class="cx">             if attendee.value() in (self.uuid, self.email):
</span><span class="cx">                 continue
</span><del>-            yield self._attendeeAutoComplete(component, attendee)
</del><ins>+            choice = random.randint(1, 100)
+            if choice &lt;= lookupPercentage:
+                yield self._attendeeAutoComplete(component, attendee)
</ins><span class="cx"> 
</span><span class="cx">         # Now do a normal PUT
</span><span class="cx">         yield self.addEvent(href, component, invite=True, attachmentSize=attachmentSize)
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestpopulationpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/population.py (15646 => 15647)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/population.py        2016-06-01 15:01:12 UTC (rev 15646)
+++ CalendarServer/trunk/contrib/performance/loadtest/population.py        2016-06-02 16:41:06 UTC (rev 15647)
</span><span class="lines">@@ -81,13 +81,13 @@
</span><span class="cx">         self.profileTypes = profileTypes
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    def new(self, reactor, server, principalPathTemplate, serializationPath, userRecord, authInfo):
</del><ins>+    def new(self, reactor, server, principalPathTemplate, serializationPath, userRecord, authInfo, instanceNumber):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Create a new instance of this client type.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         return self.clientType(
</span><span class="cx">             reactor, server, principalPathTemplate,
</span><del>-            serializationPath, userRecord, authInfo,
</del><ins>+            serializationPath, userRecord, authInfo, instanceNumber,
</ins><span class="cx">             **self.clientParams
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="lines">@@ -249,6 +249,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def add(self, numClients, clientsPerUser):
</span><ins>+        instanceNumber = 0
</ins><span class="cx">         for _ignore_n in range(numClients):
</span><span class="cx">             number = self._nextUserNumber()
</span><span class="cx"> 
</span><span class="lines">@@ -270,7 +271,9 @@
</span><span class="cx">                     self.serializationPath,
</span><span class="cx">                     record,
</span><span class="cx">                     auth,
</span><ins>+                    instanceNumber
</ins><span class="cx">                 )
</span><ins>+                instanceNumber += 1
</ins><span class="cx">                 self.clients.append(client)
</span><span class="cx">                 d = client.run()
</span><span class="cx">                 d.addErrback(self._clientFailure, reactor)
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestprofilespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/profiles.py (15646 => 15647)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2016-06-01 15:01:12 UTC (rev 15646)
+++ CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2016-06-02 16:41:06 UTC (rev 15647)
</span><span class="lines">@@ -264,6 +264,7 @@
</span><span class="cx">         recurrenceDistribution=RecurrenceDistribution(False),
</span><span class="cx">         fileAttachPercentage=30,
</span><span class="cx">         fileSizeDistribution=NormalDistribution(1024, 1),
</span><ins>+        inviteeLookupPercentage=50,
</ins><span class="cx">     ):
</span><span class="cx">         self.enabled = enabled
</span><span class="cx">         self._sendInvitationDistribution = sendInvitationDistribution
</span><span class="lines">@@ -275,6 +276,7 @@
</span><span class="cx">         self._recurrenceDistribution = recurrenceDistribution
</span><span class="cx">         self._fileAttachPercentage = fileAttachPercentage
</span><span class="cx">         self._fileSizeDistribution = fileSizeDistribution
</span><ins>+        self._inviteeLookupPercentage = inviteeLookupPercentage
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def run(self):
</span><span class="lines">@@ -381,7 +383,10 @@
</span><span class="cx">                 attachmentSize = 0 # no attachment
</span><span class="cx"> 
</span><span class="cx">             href = '%s%s.ics' % (calendar.url, uid)
</span><del>-            d = self._client.addInvite(href, vcalendar, attachmentSize=attachmentSize)
</del><ins>+            d = self._client.addInvite(
+                href, vcalendar, attachmentSize=attachmentSize,
+                lookupPercentage=self._inviteeLookupPercentage
+            )
</ins><span class="cx">             return self._newOperation(&quot;invite&quot;, d)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -632,7 +637,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._addEvent)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _addEvent(self):
</span><span class="lines">@@ -703,9 +713,15 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self.action)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def modifyEvent(self, href, vevent):
</span><span class="cx">         &quot;&quot;&quot;Overridden by subclasses&quot;&quot;&quot;
</span><span class="cx">         pass
</span><span class="lines">@@ -820,7 +836,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self.action)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="lines">@@ -920,7 +941,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._updateEvent)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _initEvent(self):
</span><span class="lines">@@ -1035,7 +1061,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._addTask)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _addTask(self):
</span><span class="lines">@@ -1082,7 +1113,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._runQuery)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _runQuery(self):
</span><span class="lines">@@ -1116,7 +1152,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._deepRefresh)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _deepRefresh(self):
</span><span class="lines">@@ -1145,7 +1186,12 @@
</span><span class="cx">     def run(self):
</span><span class="cx">         self._call = LoopingCall(self._resetAccount)
</span><span class="cx">         self._call.clock = self._reactor
</span><del>-        return self._call.start(self._interval)
</del><ins>+        self._reactor.callLater(
+            self.random.randint(1, self._interval),
+            self._call.start,
+            self._interval
+        )
+        return Deferred()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def _resetAccount(self):
</span></span></pre>
</div>
</div>

</body>
</html>