Log more in store protocol (#493)

Makes it easier to see what is going on
This commit is contained in:
Oskar Thorén 2021-04-20 09:59:14 +08:00 committed by GitHub
parent fb2ea06a4f
commit 5f1bab146d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -338,6 +338,7 @@ method init*(ws: WakuStore) =
waku_store_errors.inc(labelValues = [decodeRpcFailure])
return
# TODO Print more info here
info "received query"
let value = res.value
@ -354,6 +355,8 @@ method init*(ws: WakuStore) =
else:
info "handle store swap is nil"
info "sending response", messages=response.messages.len
await conn.writeLp(HistoryRPC(requestId: value.requestId,
response: response).encode().buffer)
@ -375,6 +378,7 @@ method init*(ws: WakuStore) =
proc init*(T: type WakuStore, peerManager: PeerManager, rng: ref BrHmacDrbgContext,
store: MessageStore = nil, wakuSwap: WakuSwap = nil): T =
debug "init"
new result
result.rng = rng
result.peerManager = peerManager
@ -393,6 +397,7 @@ proc subscription*(proto: WakuStore): MessageNotificationSubscription =
## the filter should be used by the component that receives
## new messages.
proc handle(topic: string, msg: WakuMessage) {.async.} =
debug "subscription handle", topic=topic
let index = msg.computeIndex()
proto.messages.add(IndexedWakuMessage(msg: msg, index: index))
waku_store_messages.inc(labelValues = ["stored"])