From 9ce2e8ea53ba2568373adfc8b1ebfa7b81282daf Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 23 Aug 2020 12:58:24 -0400 Subject: [PATCH] Fix progress indication for emails that have been completed. --- cps/tasks/email.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cps/tasks/email.py b/cps/tasks/email.py index 7a85b56a..be951c6b 100644 --- a/cps/tasks/email.py +++ b/cps/tasks/email.py @@ -189,7 +189,15 @@ class TaskEmail(CalibreTask): if self.asyncSMTP is not None: return self.asyncSMTP.getTransferStatus() else: - return 0 + return self._progress + + @progress.setter + def progress(self, x): + """This gets explicitly set when handle(Success|Error) are called. In this case, remove the SMTP connection""" + if x == 1: + self.asyncSMTP = None + self._progress = x + @classmethod def _get_attachment(cls, bookpath, filename):