From a059b70fe125b29eb586ab86c948c809c3ae81d4 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 2 Mar 2023 15:15:47 +0100 Subject: [PATCH] chore: add comment on cancel --- src/handler.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/handler.js b/src/handler.js index f9e7326d..27717438 100644 --- a/src/handler.js +++ b/src/handler.js @@ -183,10 +183,14 @@ async function batchResponse ({ blocks, context, logger }) { } try { + logger.info({ key: context.canceled }, 'batch response') let message = new Message() for (let i = 0; i < blocks.length; i++) { const block = blocks[i] + console.log('block key', block.key) const canceledItem = context.canceled.get(block.key) + logger.info({ key: block.key }, 'check') + logger.info({ canceled: canceledItem }, 'check') if (!canceledItem || canceledItem !== block.type) { const size = messageSize[block.type](block) @@ -203,6 +207,7 @@ async function batchResponse ({ blocks, context, logger }) { 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) } }