Skip to content

Commit

Permalink
condition change for silence
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajshekar Chavakula committed Jan 30, 2024
1 parent e472752 commit 0c22dfa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions backend/store/etcd/silenced_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,9 @@ func (s *Store) UpdateSilencedEntry(ctx context.Context, silenced *corev2.Silenc
}
allowedMaxTime := time.Now().Add(s.cfg.MaxSilencedExpiryTimeAllowed).Unix()

logger.Info("silenced ExpireAt : ", silenced.ExpireAt, " Setting: ", allowedMaxTime)

// check for maximum allowed duration for silenced allowed
if silenced.ExpireAt > 0 && (silenced.ExpireAt > allowedMaxTime) {
logger.Info("Silenced duration crossed maximum")
err := errors.New("silenced duration crossed maximum")
err := errors.New("silenced crossed maximum duration configured")
return &store.ErrNotValid{Err: err}
}

Expand All @@ -226,7 +224,7 @@ func (s *Store) UpdateSilencedEntry(ctx context.Context, silenced *corev2.Silenc
}

// set default silenced expiry time configured in backend yaml file
if silenced.Expire == 0 && silenced.ExpireAt == 0 {
if silenced.Expire <= 0 && silenced.ExpireAt == 0 {
start := time.Now()
if silenced.Begin > 0 {
start = time.Unix(silenced.Begin, 0)
Expand Down

0 comments on commit 0c22dfa

Please sign in to comment.