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!: remove dialler language #2143

Merged
merged 4 commits into from
Oct 11, 2023
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
53 changes: 53 additions & 0 deletions doc/migrations/v0.46-v1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--Specify versions for migration below-->
# Migrating to libp2p@1.0 <!-- omit in toc -->

A migration guide for refactoring your application code from libp2p v0.46 to v1.0.

## Table of Contents <!-- omit in toc -->

- [API](#api)
- [Module Updates](#module-updates)
- [Metrics](#metrics)

## API

<!--Describe breaking APIs with examples for Before and After
maschad marked this conversation as resolved.
Show resolved Hide resolved
Example:

### Peer Discovery

__Describe__

**Before**

```js

```

**After**

```js

```

-->

## Module Updates

With this release you should update the following libp2p modules if you are relying on them:

<!--Specify module versions in JSON for migration below.
It's recommended to check package.json changes for this:
`git diff <release> <prev> -- package.json`
-->

```json

```

## Metrics

The following metrics were renamed:

`libp2p_dialler_pending_dials` => `libp2p_dial_queue_pending_dials`
`libp2p_dialler_in_progress_dials` => `libp2p_dial_queue_in_progress_dials`
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
Loading