Skip to content

Commit

Permalink
chore: archive - move error to trace level when insert row fails (#2283)
Browse files Browse the repository at this point in the history
* 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. "
  • Loading branch information
Ivansete-status committed Dec 15, 2023
1 parent 306c8a6 commit 574cdf5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion waku/waku_archive/archive.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 574cdf5

Please sign in to comment.