From 3bea3bae59e7404b286b5bf97a6270270bfadd6c Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Sun, 31 Jan 2016 13:22:08 -0600 Subject: Refactor lots of things to allow you to be notified every so often, instead of every single time. --- jobs/EmailChecker.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'jobs/EmailChecker.py') diff --git a/jobs/EmailChecker.py b/jobs/EmailChecker.py index 925e0db..939d5b8 100755 --- a/jobs/EmailChecker.py +++ b/jobs/EmailChecker.py @@ -12,6 +12,8 @@ import JobBase class EmailChecker(JobBase.JobBase): def executeEvery(self): return JobBase.JobFrequency.HOUR + def notifyOnFailureEvery(self): + return JobBase.JobFailureNotificationFrequency.EVERYTIME def execute(self): USER = self.config.get('email', 'user') PASS = self.config.get('email', 'pass') @@ -47,9 +49,9 @@ class EmailChecker(JobBase.JobBase): foundSubject = True M.close() M.logout() - if not foundSubject: - #This may not work, but try anyway - self.sendEmail("Email Fetch Failure", logdetails) - return False - else: - return True + + self.logdetails = logdetails + return foundSubject + def onFailure(self): + return self.sendEmail("Email Fetch Failure", self.logdetails) + -- cgit v1.2.3