update read kv last notification time
This commit is contained in:
parent
24855bcd54
commit
56227db850
|
@ -583,9 +583,12 @@ func (engine *Engine) Do(rule *alerting.Rule) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("get last notification time from kv error: %w", err)
|
return fmt.Errorf("get last notification time from kv error: %w", err)
|
||||||
}
|
}
|
||||||
rule.LastNotificationTime, err = time.ParseInLocation(time.RFC3339, string(timeBytes), time.UTC)
|
timeStr := string(timeBytes)
|
||||||
if err != nil {
|
if timeStr != ""{
|
||||||
return fmt.Errorf("parse last notification time from kv error: %w", err)
|
rule.LastNotificationTime, err = time.ParseInLocation(time.RFC3339, string(timeBytes), time.UTC)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("parse last notification time from kv error: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
period := time.Now().Sub(rule.LastNotificationTime.Local())
|
period := time.Now().Sub(rule.LastNotificationTime.Local())
|
||||||
|
|
Loading…
Reference in New Issue