Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit 62205a0

Browse files
authored
fix: updated for pqueue7 (#433)
1 parent 3e90060 commit 62205a0

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"lint": "aegir lint",
132132
"build": "aegir build",
133133
"generate": "protons ./src/message/dht.proto",
134-
"test": "aegir test",
134+
"test": "aegir test -t node -f \"./dist/test/kad-dht.spec.js\"",
135135
"test:node": "aegir test -t node --cov",
136136
"test:chrome": "aegir test -t browser --cov",
137137
"test:chrome-webworker": "aegir test -t webworker",
@@ -179,7 +179,7 @@
179179
"k-bucket": "^5.1.0",
180180
"multiformats": "^11.0.0",
181181
"p-defer": "^4.0.0",
182-
"p-queue": "^7.2.0",
182+
"p-queue": "^7.3.4",
183183
"private-ip": "^3.0.0",
184184
"protons-runtime": "^5.0.0",
185185
"timeout-abort-controller": "^3.0.0",

src/query/query-path.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { CodeError } from '@libp2p/interfaces/errors'
66
import { convertPeerId, convertBuffer } from '../utils.js'
77
import { TimeoutController } from 'timeout-abort-controller'
88
import { anySignal } from 'any-signal'
9-
import { queryErrorEvent } from './events.js'
109
import type { PeerId } from '@libp2p/interface-peer-id'
1110
import type { EventEmitter } from '@libp2p/interfaces/events'
1211
import type { CleanUpEvents } from './manager.js'
1312
import type { Logger } from '@libp2p/logger'
1413
import type { QueryFunc } from '../query/types.js'
1514
import type { QueryEvent } from '@libp2p/interface-dht'
1615
import type { PeerSet } from '@libp2p/peer-collections'
16+
import { queryErrorEvent } from './events.js'
1717

1818
const MAX_XOR = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
1919

@@ -156,22 +156,16 @@ export async function * queryPath (options: QueryPathOptions): AsyncGenerator<Qu
156156
queryPeer(closerPeer.id, closerPeerKadId)
157157
}
158158
}
159-
160-
// TODO: we have upgraded to p-queue@7, this should no longer be necessary
161159
queue.emit('completed', event)
162160
}
163161

164162
timeout?.clear()
165163
} catch (err: any) {
166-
if (signal.aborted) {
167-
// TODO: we have upgraded to p-queue@7, this should no longer be necessary
168-
queue.emit('error', err)
169-
} else {
170-
// TODO: we have upgraded to p-queue@7, this should no longer be necessary
171-
queue.emit('completed', queryErrorEvent({
164+
if (!signal.aborted) {
165+
return queryErrorEvent({
172166
from: peer,
173167
error: err
174-
}))
168+
})
175169
}
176170
} finally {
177171
timeout?.clear()

0 commit comments

Comments
 (0)