summaryrefslogtreecommitdiff
path: root/alot/db/message.py
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-05-13 15:53:02 +0200
committerAnton Khirnov <anton@khirnov.net>2021-05-13 15:53:02 +0200
commit5045ee68b6caf8b51121f6f85e4dfcae5e5a0ba0 (patch)
treedc83deb3298920c0e57d338dba689950b0f95695 /alot/db/message.py
parent954d79c47d4c123d1dafc2c670d79685b7ce84b1 (diff)
db: implement an email message cachemsg_cache
Not in master because it doesn't seem to be the bottleneck, didn't check whether the difference is measurable.
Diffstat (limited to 'alot/db/message.py')
-rw-r--r--alot/db/message.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index 74139315..f7aea829 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -459,8 +459,7 @@ class Message:
@cached_property
def _email(self):
try:
- with open(self.filename, 'rb') as f:
- mail = email.message_from_bytes(f.read(), policy = email.policy.SMTP)
+ mail = self._dbman._email_cache.get(self.filename)
except IOError:
warning = b"Subject: Caution!\n"\
b"Message file is no longer accessible:\n%s" % self.filename