From 8a1551e0f5951bbe057a15f614bf3fcc5c9aac5f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 7 Feb 2018 17:45:06 -0600 Subject: [PATCH] Send first alert "immediately" if critical temp status i.e. only wait for "first email" delay if *not* critical courtesy of Cole Chaney --- rattail_tempmon/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rattail_tempmon/server.py b/rattail_tempmon/server.py index d254809..fde4fd7 100644 --- a/rattail_tempmon/server.py +++ b/rattail_tempmon/server.py @@ -143,9 +143,11 @@ class TempmonServerDaemon(Daemon): return # delay even the first email, until configured threshold is reached - timeout = datetime.timedelta(minutes=probe.therm_status_timeout) - if (self.now - probe.status_changed) <= timeout: - return + # unless we have a critical status + if status != self.enum.TEMPMON_PROBE_STATUS_CRITICAL_TEMP: + timeout = datetime.timedelta(minutes=probe.therm_status_timeout) + if (self.now - probe.status_changed) <= timeout: + return msgtypes = { self.enum.TEMPMON_PROBE_STATUS_LOW_TEMP : 'tempmon_low_temp',