Skip to content

Commit

Permalink
fix: increase dial queue shutdown controller signal max listeners (#1739
Browse files Browse the repository at this point in the history
)
  • Loading branch information
achingbrain authored May 5, 2023
1 parent 59f34a2 commit ed2fa79
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/connection-manager/dial-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { combineSignals, resolveMultiaddrs } from './utils.js'
import pDefer from 'p-defer'
import { ClearableSignal, anySignal } from 'any-signal'
import type { AddressSorter } from '@libp2p/interface-libp2p'
import { setMaxListeners } from 'events'

const log = logger('libp2p:connection-manager:dial-queue')

Expand Down Expand Up @@ -100,6 +101,11 @@ export class DialQueue {
this.transportManager = components.transportManager
this.shutDownController = new AbortController()

try {
// This emitter gets listened to a lot
setMaxListeners?.(Infinity, this.shutDownController.signal)
} catch {}

this.pendingDialCount = components.metrics?.registerMetric('libp2p_dialler_pending_dials')
this.inProgressDialCount = components.metrics?.registerMetric('libp2p_dialler_in_progress_dials')
this.pendingDials = []
Expand Down Expand Up @@ -258,6 +264,11 @@ export class DialQueue {
]
)

try {
// This emitter gets listened to a lot
setMaxListeners?.(Infinity, signal)
} catch {}

return signal
}

Expand Down

0 comments on commit ed2fa79

Please # to comment.