fix compilation issues

This commit is contained in:
Ivan Folgueira Bande 2024-10-25 10:47:33 +02:00
parent 25d3847413
commit b401a3626c
2 changed files with 13 additions and 12 deletions

View File

@ -88,6 +88,11 @@ proc handleMessage*(
let
msgHash = computeMessageHash(pubsubTopic, msg)
msgHashHex = msgHash.to0xHex()
msgTimestamp =
if msg.timestamp > 0:
msg.timestamp
else:
getNanosecondTime(getTime().toUnixFloat())
self.validator(msg).isOkOr:
error "failed validator message",
@ -96,7 +101,6 @@ proc handleMessage*(
contentTopic = msg.contentTopic,
msgTimestamp = msg.timestamp,
usedTimestamp = msgTimestamp,
digest = msgDigestHex,
error = $error
waku_archive_errors.inc(labelValues = [error])
return
@ -118,8 +122,7 @@ proc handleMessage*(
pubsubTopic = pubsubTopic,
contentTopic = msg.contentTopic,
msgTimestamp = msg.timestamp,
usedTimestamp = msgTimestamp,
digest = msgDigestHex
usedTimestamp = msgTimestamp
let insertDuration = getTime().toUnixFloat() - insertStartTime
waku_archive_insert_duration_seconds.observe(insertDuration)

View File

@ -82,6 +82,13 @@ proc handleMessage*(
let
msgHash = computeMessageHash(pubsubTopic, msg)
msgHashHex = msgHash.to0xHex()
msgTimestamp =
if msg.timestamp > 0:
msg.timestamp
else:
getNanosecondTime(getTime().toUnixFloat())
msgDigest = computeDigest(msg)
msgDigestHex = msgDigest.data.to0xHex()
self.validator(msg).isOkOr:
error "failed validator message",
@ -95,15 +102,6 @@ proc handleMessage*(
waku_legacy_archive_errors.inc(labelValues = [error])
return
let
msgDigest = computeDigest(msg)
msgDigestHex = msgDigest.data.to0xHex()
msgTimestamp =
if msg.timestamp > 0:
msg.timestamp
else:
getNanosecondTime(getTime().toUnixFloat())
trace "handling message",
msg_hash = msgHashHex,
pubsubTopic = pubsubTopic,