Skip to content
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
4 changes: 2 additions & 2 deletions packages/libp2p/src/connection-manager/dial-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export class DialQueue {
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.pendingDialCount = components.metrics?.registerMetric('libp2p_dial_queue_pending_dials')
this.inProgressDialCount = components.metrics?.registerMetric('libp2p_dial_queue_in_progress_dials')
this.pendingDials = []

for (const [key, value] of Object.entries(init.resolvers ?? {})) {
Expand Down
40 changes: 20 additions & 20 deletions packages/libp2p/test/connection-manager/auto-dial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { PeerStore, Peer } from '@libp2p/interface/peer-store'
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'

describe('auto-dial', () => {
let autoDialler: AutoDial
let autoDialer: AutoDial
let events: EventEmitter<Libp2pEvents>
let peerStore: PeerStore
let peerId: PeerId
Expand All @@ -38,8 +38,8 @@ describe('auto-dial', () => {
})

afterEach(() => {
if (autoDialler != null) {
autoDialler.stop()
if (autoDialer != null) {
autoDialer.stop()
}
})

Expand Down Expand Up @@ -73,16 +73,16 @@ describe('auto-dial', () => {
getDialQueue: []
})

autoDialler = new AutoDial({
autoDialer = new AutoDial({
peerStore,
connectionManager,
events
}, {
minConnections: 10,
autoDialInterval: 10000
})
autoDialler.start()
void autoDialler.autoDial()
autoDialer.start()
void autoDialer.autoDial()

await pWaitFor(() => {
return connectionManager.openConnection.callCount === 1
Expand Down Expand Up @@ -127,15 +127,15 @@ describe('auto-dial', () => {
getDialQueue: []
})

autoDialler = new AutoDial({
autoDialer = new AutoDial({
peerStore,
connectionManager,
events
}, {
minConnections: 10
})
autoDialler.start()
await autoDialler.autoDial()
autoDialer.start()
await autoDialer.autoDial()

await pWaitFor(() => connectionManager.openConnection.callCount === 1)
await delay(1000)
Expand Down Expand Up @@ -181,15 +181,15 @@ describe('auto-dial', () => {
}]
})

autoDialler = new AutoDial({
autoDialer = new AutoDial({
peerStore,
connectionManager,
events
}, {
minConnections: 10
})
autoDialler.start()
await autoDialler.autoDial()
autoDialer.start()
await autoDialer.autoDial()

await pWaitFor(() => connectionManager.openConnection.callCount === 1)
await delay(1000)
Expand All @@ -207,20 +207,20 @@ describe('auto-dial', () => {
getDialQueue: []
})

autoDialler = new AutoDial({
autoDialer = new AutoDial({
peerStore,
connectionManager,
events
}, {
minConnections: 10,
autoDialInterval: 10000
})
autoDialler.start()
autoDialer.start()

// call autodial twice
await Promise.all([
autoDialler.autoDial(),
autoDialler.autoDial()
autoDialer.autoDial(),
autoDialer.autoDial()
])

// should only have queried peer store once
Expand Down Expand Up @@ -258,17 +258,17 @@ describe('auto-dial', () => {
getDialQueue: []
})

autoDialler = new AutoDial({
autoDialer = new AutoDial({
peerStore,
connectionManager,
events
}, {
minConnections: 10,
autoDialPeerRetryThreshold: 2000
})
autoDialler.start()
autoDialer.start()

void autoDialler.autoDial()
void autoDialer.autoDial()

await pWaitFor(() => {
return connectionManager.openConnection.callCount === 1
Expand All @@ -282,7 +282,7 @@ describe('auto-dial', () => {
await delay(2000)

// autodial again
void autoDialler.autoDial()
void autoDialer.autoDial()

await pWaitFor(() => {
return connectionManager.openConnection.callCount === 3
Expand Down