mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 17:03:58 +08:00
only construct bitswap event loggable if necessary
Base58 encoding cids/peerIDs isn't exactly fast. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user