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

fix: max listeners warning #316

Merged
merged 2 commits into from
Apr 17, 2022
Merged
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
10 changes: 9 additions & 1 deletion src/query/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ export class QueryManager implements Startable, Initializable {
// don't let queries run forever
timeoutController = new TimeoutController(DEFAULT_QUERY_TIMEOUT)
options.signal = timeoutController.signal

// this signal will get listened to for network requests, etc
// so make sure we don't make a lot of noise in the logs
try {
if (setMaxListeners != null) {
setMaxListeners(Infinity, timeoutController.signal)
}
} catch {} // fails on node < 15.4
}

// allow us to stop queries on shut down
Expand All @@ -106,7 +114,7 @@ export class QueryManager implements Startable, Initializable {
// so make sure we don't make a lot of noise in the logs
try {
if (setMaxListeners != null) {
setMaxListeners(0, signal)
setMaxListeners(Infinity, signal)
}
} catch {} // fails on node < 15.4

Expand Down