@@ -6,14 +6,14 @@ import { CodeError } from '@libp2p/interfaces/errors'
66import { convertPeerId , convertBuffer } from '../utils.js'
77import { TimeoutController } from 'timeout-abort-controller'
88import { anySignal } from 'any-signal'
9- import { queryErrorEvent } from './events.js'
109import type { PeerId } from '@libp2p/interface-peer-id'
1110import type { EventEmitter } from '@libp2p/interfaces/events'
1211import type { CleanUpEvents } from './manager.js'
1312import type { Logger } from '@libp2p/logger'
1413import type { QueryFunc } from '../query/types.js'
1514import type { QueryEvent } from '@libp2p/interface-dht'
1615import type { PeerSet } from '@libp2p/peer-collections'
16+ import { queryErrorEvent } from './events.js'
1717
1818const 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