提交 914e6538 作者: Steven Allen

only construct bitswap event loggable if necessary

Base58 encoding cids/peerIDs isn't exactly fast.

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 72714b6c
......@@ -59,11 +59,13 @@ func (bs *Bitswap) taskWorker(ctx context.Context, id int) {
if !ok {
continue
}
log.Event(ctx, "Bitswap.TaskWorker.Work", logging.LoggableMap{
"ID": id,
"Target": envelope.Peer.Pretty(),
"Block": envelope.Block.Cid().String(),
})
log.Event(ctx, "Bitswap.TaskWorker.Work", logging.LoggableF(func() map[string]interface{} {
return logging.LoggableMap{
"ID": id,
"Target": envelope.Peer.Pretty(),
"Block": envelope.Block.Cid().String(),
}
}))
// update the BS ledger to reflect sent message
// TODO: Should only track *useful* messages in ledger
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论