Added doc for unread method in mail/__init__/py + make sure that db is closed before deleting the notmuch db object
This commit is contained in:
parent
cb80f133d7
commit
a480701ee6
@ -43,6 +43,10 @@ class Mail(IntervalModule):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
"""
|
||||||
|
Returns the sum of unread messages across all registered backends
|
||||||
|
"""
|
||||||
|
|
||||||
unread = sum(map(lambda backend: backend.unread, self.backends))
|
unread = sum(map(lambda backend: backend.unread, self.backends))
|
||||||
|
|
||||||
if not unread:
|
if not unread:
|
||||||
|
@ -38,7 +38,9 @@ class Notmuch(Backend):
|
|||||||
@property
|
@property
|
||||||
def unread(self):
|
def unread(self):
|
||||||
db = notmuch.Database(self.db_path)
|
db = notmuch.Database(self.db_path)
|
||||||
return notmuch.Query(db, "tag:unread and tag:inbox").count_messages()
|
result = notmuch.Query(db, "tag:unread and tag:inbox").count_messages()
|
||||||
|
db.close()
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
Backend = Notmuch
|
Backend = Notmuch
|
||||||
|
Loading…
Reference in New Issue
Block a user