diff --git a/packages/bitswap/src/bitswap.ts b/packages/bitswap/src/bitswap.ts index 0c70ed71c..5d2bf58f9 100644 --- a/packages/bitswap/src/bitswap.ts +++ b/packages/bitswap/src/bitswap.ts @@ -82,8 +82,8 @@ export class Bitswap implements BitswapInterface { async want (cid: CID, options: WantOptions = {}): Promise { const controller = new AbortController() - setMaxListeners(Infinity, controller.signal) const signal = anySignal([controller.signal, options.signal]) + setMaxListeners(Infinity, controller.signal, signal) // find providers and connect to them this.network.findAndConnect(cid, { diff --git a/packages/utils/src/utils/networked-storage.ts b/packages/utils/src/utils/networked-storage.ts index 2fd5f2417..92a79149d 100644 --- a/packages/utils/src/utils/networked-storage.ts +++ b/packages/utils/src/utils/networked-storage.ts @@ -1,4 +1,4 @@ -import { CodeError, start, stop } from '@libp2p/interface' +import { CodeError, setMaxListeners, start, stop } from '@libp2p/interface' import { anySignal } from 'any-signal' import { IdentityBlockstore } from 'blockstore-core/identity' import { TieredBlockstore } from 'blockstore-core/tiered' @@ -250,6 +250,7 @@ async function raceBlockRetrievers (cid: CID, blockBrokers: BlockBroker[], hashe const controller = new AbortController() const signal = anySignal([controller.signal, options.signal]) + setMaxListeners(Infinity, controller.signal, signal) const retrievers: Array>> = []