From b34f5d3117f4ef375d1816b0fe76e3490aa89f4c Mon Sep 17 00:00:00 2001 From: Ivan FB <128452529+Ivansete-status@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:58:35 +0100 Subject: [PATCH] chore: archive - move error to trace level when insert row fails (#2283) * archive: move error to trace level when insert row fails That is helpful to prevent the node to spam the logs when it shares connection to the same Postgres database with other nodes, in which case the following log appears too much: topics="waku archive" tid=1 file=archive.nim:113 err="error in runStmt: error in dbConnQueryPrepared calling waitQueryToFinish: error in query: ERROR: duplicate key value violates unique constraint "messageindex" DETAIL: Key (messagehash)=(88f4ee115eef6f233a7dceaf975f03946e18666adda877e38d61be98add934e8) already exists. " --- waku/waku_archive/archive.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/waku/waku_archive/archive.nim b/waku/waku_archive/archive.nim index 435fb4e2e..db642e383 100644 --- a/waku/waku_archive/archive.nim +++ b/waku/waku_archive/archive.nim @@ -112,7 +112,10 @@ proc handleMessage*(w: WakuArchive, let putRes = await w.driver.put(pubsubTopic, msg, msgDigest, msgHash, msgReceivedTime) if putRes.isErr(): - error "failed to insert message", err=putRes.error + if "duplicate key value violates unique constraint" in putRes.error: + trace "failed to insert message", err=putRes.error + else: + debug "failed to insert message", err=putRes.error waku_archive_errors.inc(labelValues = [insertFailure]) let insertDuration = getTime().toUnixFloat() - insertStartTime