Skip to content

Commit

Permalink
ALL-3800 - Fix potential memory issues in LoadBalancer - misc 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Smrecz committed Dec 14, 2023
1 parent c6b7775 commit 166cc30
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/service/rpc/generic/LoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class LoadBalancer implements AbstractRpcInterface {
}

if (typeof process !== 'undefined' && process.release && process.release.name === 'node') {
process.on('exit', this.exitHandler)
process.on('exit', () => this.destroy())
}

if (!config.rpc?.oneTimeLoadBalancing) {
Expand All @@ -106,13 +106,9 @@ export class LoadBalancer implements AbstractRpcInterface {
}
}

private exitHandler() {
this.destroy()
}

destroy() {
clearInterval(this.interval)
process.off('exit', this.exitHandler)
process.off('exit', () => this.destroy())
}

private initCustomNodes(nodes: RpcNode[]) {
Expand Down

0 comments on commit 166cc30

Please sign in to comment.