[CalendarServer-changes] [15104] CalendarServer/branches/users/sredmond/clientsim/contrib/ performance/loadtest/push.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 4 11:35:35 PDT 2015
Revision: 15104
http://trac.calendarserver.org//changeset/15104
Author: sredmond at apple.com
Date: 2015-09-04 11:35:34 -0700 (Fri, 04 Sep 2015)
Log Message:
-----------
Moves defensive amp connection to internal methods
Modified Paths:
--------------
CalendarServer/branches/users/sredmond/clientsim/contrib/performance/loadtest/push.py
Modified: CalendarServer/branches/users/sredmond/clientsim/contrib/performance/loadtest/push.py
===================================================================
--- CalendarServer/branches/users/sredmond/clientsim/contrib/performance/loadtest/push.py 2015-09-04 17:18:38 UTC (rev 15103)
+++ CalendarServer/branches/users/sredmond/clientsim/contrib/performance/loadtest/push.py 2015-09-04 18:35:34 UTC (rev 15104)
@@ -1,7 +1,7 @@
import uuid
from twisted.internet.endpoints import TCP4ClientEndpoint
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, succeed
from calendarserver.push.amppush import SubscribeToID, UnsubscribeFromID, AMPPushClientFactory
@@ -86,8 +86,7 @@
monitor.addPushkey('/CalDAV/localhost/<uid>', '/calendars/__uids__/<uid>')
"""
self._ampPushkeys[pushkey] = href
- if self._connected:
- return self._subscribeToPushkey(pushkey)
+ return self._subscribeToPushkey(pushkey)
def removePushkey(self, pushkey):
"""
@@ -95,8 +94,7 @@
"""
if pushkey in self._ampPushkeys:
del self._ampPushkeys[pushkey]
- if self._connected:
- return self._unsubscribeFromPushkey(pushkey)
+ return self._unsubscribeFromPushkey(pushkey)
def isSubscribedTo(self, href):
"""
@@ -115,9 +113,13 @@
yield self._unsubscribeFromPushkey(pushkey)
def _subscribeToPushkey(self, pushkey):
+ if not self._connected:
+ return succeed(None)
return self._protocol.callRemote(SubscribeToID, token=self._token, id=pushkey)
def _unsubscribeFromPushkey(self, pushkey):
+ if not self._connected:
+ return succeed(None)
return self._protocol.callRemote(UnsubscribeFromID, id=pushkey)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150904/e658990a/attachment.html>
More information about the calendarserver-changes
mailing list