From 3dd1e42e08611a8eee7506585cf1946c9469cf9d Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 16 Feb 2007 12:50:39 +0000 Subject: safer timewindow semantics --- it.class | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it.class b/it.class index 2bddcd2..1dad9d7 100644 --- a/it.class +++ b/it.class @@ -66,8 +66,8 @@ function timerlog($label = '') * @param $body (optional) error body, multiline * @param $to (optional) comma separated recipient list * @param named parameter id identifier of error. if given, only subsequent errors of same id will trigger message - * @param named parameter timewindow number of seconds within which the second error must occur * @param named parameter graceperiod number of seconds within which additional errors are ignored + * @param named parameter timewindow number of seconds after graceperiod within which the second error must occur */ function error($p = array(), $body = "", $to = "") { @@ -93,7 +93,7 @@ function error($p = array(), $body = "", $to = "") $stampfn = $GLOBALS['ULTRAHOME'] . "/tmp/errstamp_" . urlencode($p['id']); $stampage = time() - @filemtime($stampfn); - if ($stampage >= $p['graceperiod'] && $stampage <= $p['timewindow']) + if ($stampage >= $p['graceperiod'] && $stampage <= $p['graceperiod'] + $p['timewindow']) $sendalert = true; if ($stampage >= $p['graceperiod']) # constantly occurring errors should not suppress mail -- cgit v1.2.3