[CalendarServer-changes] [5952] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 26 16:37:53 PDT 2010


Revision: 5952
          http://trac.macosforge.org/projects/calendarserver/changeset/5952
Author:   sagen at apple.com
Date:     2010-07-26 16:37:52 -0700 (Mon, 26 Jul 2010)
Log Message:
-----------
Don't delay PROPFIND results when push notification server is broken (8185248)

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/notify.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py	2010-07-26 22:43:05 UTC (rev 5951)
+++ CalendarServer/trunk/twistedcaldav/notify.py	2010-07-26 23:37:52 UTC (rev 5952)
@@ -330,7 +330,20 @@
             self.log_debug("Giving up!")
             raise NodeCreationException("Could not create node %s" % (nodeName,))
 
+    def createNode(self, notifier, nodeName):
+        """
+        Check with memcached to see if this node is known to exist, and if
+        not, request it be created (without waiting)
+        """
+        def _nodeExistenceChecked(result):
+            if not result:
+                notifier.notify(op="create")
 
+        d = self.nodeExists(nodeName)
+        d.addCallback(_nodeExistenceChecked)
+        return d
+
+
 _nodeCacher = None
 
 def getNodeCacher():

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2010-07-26 22:43:05 UTC (rev 5951)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2010-07-26 23:37:52 UTC (rev 5952)
@@ -409,10 +409,7 @@
                     nodeName = getPubSubPath(id, pubSubConfiguration)
                     propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
                     nodeCacher = getNodeCacher()
-                    try:
-                        (yield nodeCacher.waitForNode(self.clientNotifier, nodeName))
-                    except NodeCreationException:
-                        pass
+                    (yield nodeCacher.createNode(self.clientNotifier, nodeName))
                     returnValue(propVal)
 
                 else:

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2010-07-26 22:43:05 UTC (rev 5951)
+++ CalendarServer/trunk/twistedcaldav/static.py	2010-07-26 23:37:52 UTC (rev 5952)
@@ -1228,7 +1228,7 @@
 
                     propVal = customxml.PubSubPushTransportsProperty(*children)
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the value
                     d.addBoth(lambda ignored: propVal)
                     return d
@@ -1245,7 +1245,7 @@
                     nodeName = getPubSubPath(id, pubSubConfiguration)
                     propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the xmpp-uri value
                     d.addBoth(lambda ignored: propVal)
                     return d
@@ -1262,7 +1262,7 @@
                     propVal = customxml.PubSubXMPPURIProperty(
                         getPubSubXMPPURI(id, pubSubConfiguration))
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the xmpp-uri value
                     d.addBoth(lambda ignored: propVal)
                     return d
@@ -1880,7 +1880,7 @@
 
                     propVal = customxml.PubSubPushTransportsProperty(*children)
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the value
                     d.addBoth(lambda ignored: propVal)
                     return d
@@ -1897,7 +1897,7 @@
                     nodeName = getPubSubPath(id, pubSubConfiguration)
                     propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the xmpp-uri value
                     d.addBoth(lambda ignored: propVal)
                     return d
@@ -1914,7 +1914,7 @@
                     propVal = customxml.PubSubXMPPURIProperty(
                         getPubSubXMPPURI(id, pubSubConfiguration))
                     nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
+                    d = nodeCacher.createNode(self.clientNotifier, nodeName)
                     # In either case we're going to return the xmpp-uri value
                     d.addBoth(lambda ignored: propVal)
                     return d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100726/ba3da65e/attachment-0001.html>


More information about the calendarserver-changes mailing list