Skip to content

Commit

Permalink
Merge pull request #4533 from ipfs/nit/bitswap-loggable
Browse files Browse the repository at this point in the history
only construct bitswap event loggable if necessary
  • Loading branch information
whyrusleeping authored Dec 31, 2017
2 parents 72714b6 + 914e653 commit 026d873
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions exchange/bitswap/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 026d873

Please sign in to comment.