Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increase default listers on abort signals #484

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bitswap/src/bitswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export class Bitswap implements BitswapInterface {

async want (cid: CID, options: WantOptions = {}): Promise<Uint8Array> {
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, {
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/src/utils/networked-storage.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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<Required<Pick<BlockBroker, 'retrieve'>>> = []

Expand Down
Loading