diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-06-09 17:55:50 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-06-09 17:55:50 -0400 |
| commit | 1d1f6d4fd023e0f9b9851aff259a0b9f022ed13f (patch) | |
| tree | 068b2bc821ca76cf2fbb371e57e28279d547347a /cmd/main/main.go | |
| parent | 6ec85b96ad4fee6ec1767f6b78f92a38ce658a06 (diff) | |
| download | checkup-1d1f6d4fd023e0f9b9851aff259a0b9f022ed13f.tar.gz checkup-1d1f6d4fd023e0f9b9851aff259a0b9f022ed13f.tar.xz | |
Add a nag option ( RenotifyInterval )
Diffstat (limited to 'cmd/main/main.go')
| -rw-r--r-- | cmd/main/main.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/main/main.go b/cmd/main/main.go index 1b264a3..531b0ab 100644 --- a/cmd/main/main.go +++ b/cmd/main/main.go @@ -19,6 +19,7 @@ type jobResponse struct { Id string Message string Err error + Time time.Time } type Config struct { @@ -31,6 +32,7 @@ type Config struct { StatusChecks map[string]*int `yaml:"StatusChecks"` Workers int `yaml:"Workers"` Interval int `yaml:"Interval"` + RenotifyInterval int `yaml:"RenotifyInterval"` HTTPTimeout int `yaml:"HTTPTimeout"` } @@ -57,6 +59,18 @@ func jobNotifyDedup(conf *Config, prevJobs, newJobs map[string]*jobResponse) { } if oldresp.Message == resp.Message { + // This isn't new, adjust accordingly + newJobs[id] = prevJobs[id] + + if time.Now().After( + oldresp.Time.Add(time.Duration(conf.RenotifyInterval) * time.Second)) { + + buf.Write([]byte( + "still active --> " + resp.Message, + )) + buf.Write([]byte{'\n'}) + } + continue } @@ -134,6 +148,7 @@ func main() { CertWindow: 15, ExpectedStatusCode: 200, Interval: 60, + RenotifyInterval: 900, } err := ReadConfig(*confFn, conf) |
