Skip to content

Commit

Permalink
fix: infinite alert bug 💀
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Sep 13, 2023
1 parent 18ea30b commit d2cbd77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func getLastUpdatedSeconds() float64 {
var alertThreshold = 10.0

func incrementLevel() {
if alertThreshold == 3600.0 {
if alertThreshold >= 3600.0 {
alertThreshold += 3600.0
return
}
Expand Down Expand Up @@ -98,6 +98,7 @@ func setHealth() {
healthStatus.Set(0)

if lastUpdatedSeconds >= alertThreshold {
fmt.Printf("Alerting: threshold = %f\n", alertThreshold)
alertDiscord()
incrementLevel()
}
Expand Down

0 comments on commit d2cbd77

Please sign in to comment.