Skip to content

Commit

Permalink
[silences] Don't merge expired silences
Browse files Browse the repository at this point in the history
If they're expired, they should be cleaned up on
the next GC cycle, but merging them in means that
they'll probably be gossip'd continually between
the cluster members.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
  • Loading branch information
stuartnelson3 committed Nov 20, 2018
1 parent 573389a commit 066e9ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions silence/silence.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,12 @@ func (s *Silences) Merge(b []byte) error {
s.mtx.Lock()
defer s.mtx.Unlock()

now := s.now()

for _, e := range st {
if e.ExpiresAt.Before(now) {
continue
}
if merged := s.st.merge(e); merged && !cluster.OversizedMessage(b) {
// If this is the first we've seen the message and it's
// not oversized, gossip it to other nodes. We don't
Expand Down

0 comments on commit 066e9ac

Please sign in to comment.