Skip to content

Commit

Permalink
only construct bitswap event loggable if necessary
Browse files Browse the repository at this point in the history
Base58 encoding cids/peerIDs isn't exactly fast.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Dec 29, 2017
1 parent 72714b6 commit 914e653
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 914e653

Please sign in to comment.