bnporc: Much faster checking of new messages
Especially for the first call on a new backend instance. We don't need to fill threads that are already in "seen".
This commit is contained in:
parent
0e113544da
commit
e7f6086916
1 changed files with 3 additions and 4 deletions
|
|
@ -152,10 +152,9 @@ class BNPorcBackend(BaseBackend, ICapBank, ICapMessages):
|
|||
def iter_unread_messages(self, thread=None):
|
||||
threads = list(self.iter_threads(cache=True))
|
||||
for thread in threads:
|
||||
thread = self.fillobj(thread) or thread
|
||||
for m in thread.iter_all_messages():
|
||||
if m.flags & m.IS_UNREAD:
|
||||
yield m
|
||||
if thread.root.flags & thread.root.IS_UNREAD:
|
||||
thread = self.fillobj(thread) or thread
|
||||
yield thread.root
|
||||
|
||||
def set_message_read(self, message):
|
||||
self.storage.get('seen', default=[]).append(message.thread.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue