Skip to content

Commit

Permalink
feat: ✨ Removed an unnecessary request to the nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Sep 6, 2024
1 parent e819a1f commit 531101a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/tendermint-rpc/src/comet38/comet38client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export class Comet38Client {
// (our CI) when skipping the status call before doing other queries. Sleeping a little
// while did not help. Thus we query the version as a way to say "hi" to the backend,
// even in cases where we don't use the result.
const _version = await this.detectVersion(rpcClient);
// However we can run this code only inside our CI, so we don't have to run this code inside the prod build,
// this avoids an unnecessary request to the RPC nodes
if (process.env.TENDERMINT_ENABLED) {
const _version = await this.detectVersion(rpcClient);
}

return Comet38Client.create(rpcClient);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export class Tendermint34Client {
// (our CI) when skipping the status call before doing other queries. Sleeping a little
// while did not help. Thus we query the version as a way to say "hi" to the backend,
// even in cases where we don't use the result.
const _version = await this.detectVersion(rpcClient);
// However we can run this code only inside our CI, so we don't have to run this code inside the prod build,
// this avoids an unnecessary request to the RPC nodes
if (process.env.TENDERMINT_ENABLED) {
const _version = await this.detectVersion(rpcClient);
}

return Tendermint34Client.create(rpcClient);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export class Tendermint37Client {
// (our CI) when skipping the status call before doing other queries. Sleeping a little
// while did not help. Thus we query the version as a way to say "hi" to the backend,
// even in cases where we don't use the result.
const _version = await this.detectVersion(rpcClient);
// However we can run this code only inside our CI, so we don't have to run this code inside the prod build,
// this avoids an unnecessary request to the RPC nodes
if (process.env.TENDERMINT_ENABLED) {
const _version = await this.detectVersion(rpcClient);
}

return Tendermint37Client.create(rpcClient);
}
Expand Down

0 comments on commit 531101a

Please sign in to comment.