Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc-client: Use concurrency to avoid serial network calls #5089

Open
joncinque opened this issue Feb 27, 2025 · 0 comments
Open

rpc-client: Use concurrency to avoid serial network calls #5089

joncinque opened this issue Feb 27, 2025 · 0 comments
Assignees

Comments

@joncinque
Copy link

Problem

The nonblocking RPC client has a tendency to serialize network calls unnecessarily, making the whole client slower than needed.

For example, see

let recent_blockhash = if transaction.uses_durable_nonce() {
self.get_latest_blockhash_with_commitment(CommitmentConfig::processed())
.await?
.0
} else {
*transaction.get_recent_blockhash()
};
let signature = self
.send_transaction_with_config(transaction, config)
.await?;
self.confirm_transaction_with_spinner(&signature, &recent_blockhash, commitment)
.await?;

Proposed Solution

In that example, the first two network calls can happen concurrently, since they have no relation to each other. We should rather join! those two futures using https://docs.rs/futures/latest/futures/macro.join.html

And there are likely many more examples like this throughout the rpc-client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants