From 46413c8dff32688e3b06f5941d5fdaa697ecb8c1 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 10 Nov 2025 21:03:24 +1100 Subject: [PATCH] catch CancelledError in BlockExchange --- codex/blockexchange/engine/engine.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codex/blockexchange/engine/engine.nim b/codex/blockexchange/engine/engine.nim index ddbad52c..962de133 100644 --- a/codex/blockexchange/engine/engine.nim +++ b/codex/blockexchange/engine/engine.nim @@ -716,6 +716,8 @@ proc blocksDeliveryHandler*( ).errorOption: warn "Unable to store proof and cid for a block" continue + except CancelledError: + trace "Block delivery handling cancelled" except CatchableError as exc: warn "Error handling block delivery", error = exc.msg continue @@ -963,6 +965,8 @@ proc blockexcTaskRunner(self: BlockExcEngine) {.async: (raises: []).} = while self.blockexcRunning: let peerCtx = await self.taskQueue.pop() await self.taskHandler(peerCtx) + except CancelledError: + trace "block exchange task runner cancelled", peer = peerCtx.id except CatchableError as exc: error "error running block exchange task", error = exc.msg