2 Commits
0.3.1 ... 0.4.0

Author SHA1 Message Date
a0733f70e5 handle negative values, fix 1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-04-09 13:07:28 +02:00
53dc8a68a3 handle negative values
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-04-09 13:01:57 +02:00

View File

@ -56,6 +56,9 @@ func calculateDifference(key string, newValue string) (string, error) {
Timestamp: currentTime, Timestamp: currentTime,
Value: newValue, Value: newValue,
} }
if diffValuePerSecond < 0 {
return "", fmt.Errorf("negative difference value: %d", diffValuePerSecond)
}
return strconv.Itoa(diffValuePerSecond), nil return strconv.Itoa(diffValuePerSecond), nil
} else { } else {
log.Printf("create lvv for %s", key) log.Printf("create lvv for %s", key)