Mercurial > libervia-pubsub
changeset 339:516b282aa542
backend (notifications): avoid useless database request in getNotifications
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 20 Aug 2017 10:59:47 +0200 |
parents | 6d059f07c2d3 |
children | 567e486bce24 |
files | sat_pubsub/backend.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_pubsub/backend.py Sat Aug 12 18:29:32 2017 +0200 +++ b/sat_pubsub/backend.py Sun Aug 20 10:59:47 2017 +0200 @@ -362,7 +362,7 @@ '//event/pubsub/notify') - def getNotifications(self, nodeDbId, items_data): + def getNotifications(self, node, items_data): """Build a list of subscriber to the node subscribers will be associated with subscribed items, @@ -388,8 +388,7 @@ failure.trap(error.NodeNotFound) return [] - d1 = self.storage.getNodeById(nodeDbId) - d1.addCallback(lambda node: node.getSubscriptions('subscribed')) + d1 = node.getSubscriptions('subscribed') # FIXME: must add root node subscriptions ? # d2 = self.storage.getNode('', False) # FIXME: to check # d2.addCallback(lambda node: node.getSubscriptions('subscribed')) @@ -1124,7 +1123,7 @@ if subscription is None: - notifications = yield self.backend.getNotifications(node.nodeDbId, items_data) + notifications = yield self.backend.getNotifications(node, items_data) else: notifications = [(subscription.subscriber, [subscription], items_data)]