Skip to content

Commit

Permalink
chore: add comment on cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Mar 3, 2023
1 parent faeab9a commit f50c939
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,16 @@ async function batchResponse ({ blocks, context, logger }) {
const block = blocks[i]
const canceledItem = context.canceled.get(block.key)

logger.info({ keyList: context.canceled.keyList }, 'check keyList')
logger.info({ key: block.key, type: block.type, wantType: block.wantType }, 'check')
logger.info({ canceled: canceledItem }, 'canceled')

if (canceledItem === block.wantType) {
const size = messageSize[block.type](block)
telemetry.increaseLabelCount('bitswap-block-success-cancel', [block.type])
telemetry.increaseLabelCount('bitswap-cancel-size', [block.type], size)

logger.info({ key: block.key }, 'delete')
context.canceled.delete(block.key)
} else {
const size = messageSize[block.type](block)
Expand Down

0 comments on commit f50c939

Please sign in to comment.