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):
|
def iter_unread_messages(self, thread=None):
|
||||||
threads = list(self.iter_threads(cache=True))
|
threads = list(self.iter_threads(cache=True))
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread = self.fillobj(thread) or thread
|
if thread.root.flags & thread.root.IS_UNREAD:
|
||||||
for m in thread.iter_all_messages():
|
thread = self.fillobj(thread) or thread
|
||||||
if m.flags & m.IS_UNREAD:
|
yield thread.root
|
||||||
yield m
|
|
||||||
|
|
||||||
def set_message_read(self, message):
|
def set_message_read(self, message):
|
||||||
self.storage.get('seen', default=[]).append(message.thread.id)
|
self.storage.get('seen', default=[]).append(message.thread.id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue