Skip to content

Commit

Permalink
ALL-6920: disable auto-discovery of RPC nodes when there is only one … (
Browse files Browse the repository at this point in the history
#1112)

* ALL-6920: disable auto-discovery of RPC nodes when there is only one node

* ALL-6920: rebase fix
  • Loading branch information
rostislavjadavan authored Jun 20, 2024
1 parent e67fd3c commit 6c947da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## [4.2.34] - 2024.6.178
## [4.2.35] - 2024.6.18

### Updated

- Disable auto-discovery of RPC nodes when there is only one node.

## [4.2.34] - 2024.6.18

### Added

- Support for Casper mainnet
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "4.2.34",
"version": "4.2.35",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
12 changes: 7 additions & 5 deletions src/service/rpc/generic/LoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ export class LoadBalancer implements AbstractRpcInterface {
process.on('exit', () => this.destroy())
}

if (config.rpc?.oneTimeLoadBalancing) {
Utils.log({ id: this.id, message: 'oneTimeLoadBalancing enabled' })
await this.checkStatuses()
} else {
this.interval = setInterval(() => this.checkStatuses(), Constant.OPEN_RPC.LB_INTERVAL)
if (nodes && nodes.length > 1) {
if (config.rpc?.oneTimeLoadBalancing) {
Utils.log({ id: this.id, message: 'oneTimeLoadBalancing enabled' })
await this.checkStatuses()
} else {
this.interval = setInterval(() => this.checkStatuses(), Constant.OPEN_RPC.LB_INTERVAL)
}
}
}

Expand Down

0 comments on commit 6c947da

Please sign in to comment.