You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/30 16:25:10 UTC
[3/4] git commit: [#4994] Added more logging when sending
notifications for debugging
[#4994] Added more logging when sending notifications for debugging
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f3923bf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f3923bf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f3923bf2
Branch: refs/heads/master
Commit: f3923bf2095afaf2f0c79f8da4f151560727a105
Parents: 9bc64c9
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 29 17:28:25 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 23:10:23 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/notification.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f3923bf2/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 1ec530a..ebc0eef 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -237,6 +237,7 @@ class Notification(MappedClass):
def send_direct(self, user_id):
user = User.query.get(_id=ObjectId(user_id))
artifact = self.ref.artifact
+ log.debug('Sending direct notification %s to user %s', self._id, user_id)
# Don't send if user doesn't have read perms to the artifact
if user and artifact and \
not security.has_access(artifact, 'read', user)():
@@ -265,6 +266,7 @@ class Notification(MappedClass):
security.has_access(artifact, 'read', user)()
notifications = filter(perm_check, notifications)
+ log.debug('Sending digest of notifications [%s] to user %s', ', '.join([n._id for n in notifications]), user_id)
if reply_to_address is None:
reply_to_address = from_address
text = [ 'Digest of %s' % subject ]
@@ -287,6 +289,7 @@ class Notification(MappedClass):
@classmethod
def send_summary(self, user_id, from_address, subject, notifications):
if not notifications: return
+ log.debug('Sending summary of notifications [%s] to user %s', ', '.join([n._id for n in notifications]), user_id)
text = [ 'Digest of %s' % subject ]
for n in notifications:
text.append('From: %s' % n.from_address)
@@ -453,7 +456,9 @@ class Mailbox(MappedClass):
'artifact_index_id':{'$in':[None, artifact_index_id]},
'topic':{'$in':[None, topic]}
}
- for mbox in cls.query.find(d):
+ mboxes = cls.query.find(d).all()
+ log.debug('Delivering notification %s to mailboxes [%s]', nid, ', '.join([str(m._id) for m in mboxes]))
+ for mbox in mboxes:
try:
mbox.query.update(
{'$push':dict(queue=nid),
@@ -527,6 +532,7 @@ class Mailbox(MappedClass):
'''
notifications = Notification.query.find(dict(_id={'$in':self.queue}))
notifications = notifications.all()
+ log.debug('Firing mailbox %s notifications [%s], found [%s]', str(self._id), ', '.join(self.queue), ', '.join([n._id for n in notifications]))
if self.type == 'direct':
ngroups = defaultdict(list)
for n in notifications: