Fluffy: Reduce info logs when looking up state. (#2890)

This commit is contained in:
bhartnett 2024-11-28 22:00:03 +08:00 committed by GitHub
parent 23a43d1d15
commit e74d5c3f22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,17 +94,15 @@ proc getContent(
let contentValue = V.decode(maybeLocalContent.get()).valueOr:
raiseAssert("Unable to decode state local content value")
info "Fetched state local content value"
debug "Fetched state local content value"
return Opt.some(contentValue)
for i in 0 ..< (1 + n.contentRequestRetries):
let
contentLookupResult = (
await n.portalProtocol.contentLookup(contentKeyBytes, contentId)
).valueOr:
lookupRes = (await n.portalProtocol.contentLookup(contentKeyBytes, contentId)).valueOr:
warn "Failed fetching state content from the network"
return Opt.none(V)
contentValueBytes = contentLookupResult.content
contentValueBytes = lookupRes.content
let contentValue = V.decode(contentValueBytes).valueOr:
error "Unable to decode state content value from content lookup"
@ -114,15 +112,18 @@ proc getContent(
error "Validation of retrieved state content failed"
continue
info "Fetched valid state content from the network"
debug "Fetched valid state content from the network"
n.portalProtocol.storeContent(
contentKeyBytes, contentId, contentValueBytes, cacheContent = true
)
if maybeParentOffer.isSome():
if maybeParentOffer.isSome() and lookupRes.nodesInterestedInContent.len() > 0:
debug "Sending content to interested nodes",
interestedNodesCount = lookupRes.nodesInterestedInContent.len()
let offer = contentValue.toOffer(maybeParentOffer.get())
n.portalProtocol.triggerPoke(
contentLookupResult.nodesInterestedInContent, contentKeyBytes, offer.encode()
lookupRes.nodesInterestedInContent, contentKeyBytes, offer.encode()
)
return Opt.some(contentValue)