diff --git a/nflog/nflog.go b/nflog/nflog.go index a6c3160880..13cd2c0fd7 100644 --- a/nflog/nflog.go +++ b/nflog/nflog.go @@ -33,7 +33,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/promslog" - "github.com/prometheus/alertmanager/cluster" pb "github.com/prometheus/alertmanager/nflog/nflogpb" ) @@ -526,17 +525,19 @@ func (l *Log) Merge(b []byte) error { defer l.mtx.Unlock() now := l.now() + needsBroadcast := false for _, e := range st { - if merged := l.st.merge(e, now); 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 - // propagate oversized messages because they're sent to - // all nodes already. - l.broadcast(b) - l.metrics.propagatedMessagesTotal.Inc() - l.logger.Debug("gossiping new entry", "entry", e) + if merged := l.st.merge(e, now); merged { + // If this is the first we've seen the message, gossip state to other nodes. + needsBroadcast = true } } + + if needsBroadcast { + l.broadcast(b) + l.metrics.propagatedMessagesTotal.Inc() + l.logger.Debug("gossiping received state") + } return nil }