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

perf(station): make concurrent balance queries more efficient #440

Open
wants to merge 4 commits into
base: multi-chain-support
Choose a base branch
from

Conversation

olaszakos
Copy link
Contributor

At the moment concurrent calls to fetch the balances of the assets of an account result in all of them fetching the balances with inter canister calls.

If an account asset balance is getting queried concurrent calls should not result in additional balance queries, but those should return the last balance value.

@olaszakos olaszakos requested a review from a team as a code owner November 25, 2024 15:57
@olaszakos olaszakos changed the base branch from main to multi-chain-support November 25, 2024 15:58
fn from(balance: &AccountBalance) -> Self {
let balance_age_ms = crate::core::ic_cdk::api::time()
.saturating_sub(balance.last_modification_timestamp)
/ 1000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time get's back the time in nanoseconds, to get the miliseconds you need to divide by 1_000_000

CallerGuard::new(
state.clone(),
balance_update_guard_key,
Some(time() + Duration::from_secs(60).as_nanos() as u64),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to increase this to 5min in case the subnet would be with high load

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

Successfully merging this pull request may close these issues.

2 participants