From 4693b451ed7999cbdd7cf529e2134e518527f357 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Mon, 16 Oct 2023 17:31:34 +0200 Subject: [PATCH] fix: change heartbeat to use maximum received timestamp --- receive.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/receive.go b/receive.go index 395a01a..72fd02f 100644 --- a/receive.go +++ b/receive.go @@ -166,7 +166,9 @@ func ReceiveMessages(channel chan *vaa.VAA, heartbeat *Heartbeat, networkID stri // Send message on channel, increment counter, and update heartbeat channel <- vaa messagesMetric.Inc() - heartbeat.Timestamp = vaa.Timestamp.Unix() + if vaa.Timestamp.Unix() > heartbeat.Timestamp { + heartbeat.Timestamp = vaa.Timestamp.Unix() + } log.Debug().Str("id", vaa.MessageID()).Msg("Received message") }