allura
修訂 | e3fd1b8b4c597837858803f910c4ee3b24860ae0 (tree) |
---|---|
時間 | 2011-12-14 07:10:39 |
作者 | Tim Van Steenburgh <tvansteenburgh@geek...> |
Commiter | Tim Van Steenburgh |
[#3270] Revert change to Mailbox query due to performance problems.
Signed-off-by: Tim Van Steenburgh <tvansteenburgh@geek.net>
@@ -443,20 +443,20 @@ class Mailbox(MappedClass): | ||
443 | 443 | now = datetime.utcnow() |
444 | 444 | # Queries to find all matching subscription objects |
445 | 445 | q_direct = dict( |
446 | - type='direct') | |
446 | + type='direct', | |
447 | + queue={'$ne':[]}) | |
447 | 448 | if MAILBOX_QUIESCENT: |
448 | 449 | q_direct['last_modified']={'$lt':now - MAILBOX_QUIESCENT} |
449 | 450 | q_digest = dict( |
450 | 451 | type={'$in': ['digest', 'summary']}, |
451 | 452 | next_scheduled={'$lt':now}) |
452 | 453 | for mbox in cls.query.find(q_direct): |
453 | - if mbox.queue: | |
454 | - mbox = cls.query.find_and_modify( | |
455 | - query=dict(_id=mbox._id), | |
456 | - update={'$set': dict( | |
457 | - queue=[])}, | |
458 | - new=False) | |
459 | - mbox.fire(now) | |
454 | + mbox = cls.query.find_and_modify( | |
455 | + query=dict(_id=mbox._id), | |
456 | + update={'$set': dict( | |
457 | + queue=[])}, | |
458 | + new=False) | |
459 | + mbox.fire(now) | |
460 | 460 | for mbox in cls.query.find(q_digest): |
461 | 461 | next_scheduled = now |
462 | 462 | if mbox.frequency.unit == 'day': |