Skip to content

Commit cf9aab5

Browse files
authored
fix: silence max listeners warning for dht routing table (#3233)
Increase the maximum number of listeners for the routing table's shutdown controller signal.
1 parent cb1c14e commit cf9aab5

File tree

1 file changed

+3
-0
lines changed
  • packages/kad-dht/src/routing-table

1 file changed

+3
-0
lines changed

packages/kad-dht/src/routing-table/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class RoutingTable extends TypedEventEmitter<RoutingTableEvents> implemen
118118
this.populateFromDatastoreOnStart = init.populateFromDatastoreOnStart ?? POPULATE_FROM_DATASTORE_ON_START
119119
this.populateFromDatastoreLimit = init.populateFromDatastoreLimit ?? POPULATE_FROM_DATASTORE_LIMIT
120120
this.shutdownController = new AbortController()
121+
setMaxListeners(Infinity, this.shutdownController.signal)
121122

122123
this.pingOldContactQueue = new PeerQueue({
123124
concurrency: init.pingOldContactConcurrency ?? PING_OLD_CONTACT_CONCURRENCY,
@@ -190,6 +191,8 @@ export class RoutingTable extends TypedEventEmitter<RoutingTableEvents> implemen
190191
this.running = true
191192

192193
this.shutdownController = new AbortController()
194+
setMaxListeners(Infinity, this.shutdownController.signal)
195+
193196
await start(this.closestPeerTagger, this.kb)
194197
}
195198

0 commit comments

Comments
 (0)