My setup consist of 2 two canisters. backend
and ord-indexer
.
ord-indexer
is responsible for filtering and storing utxos.
when I need to check for balance,
I need to run a loop over the utxos owned by the user’s address. then a call is made to ord-canister
, if the utxos contains rune.
I’m confused what’s happening. The call passes sometimes but it fails too.
I’m getting request timed out error.
Making loop of inter-canister calls shouldn’t be a problem, right?
there is a timer running on ord-indexer
.
pub fn sync(secs: u64) {
ic_cdk_timers::set_timer(std::time::Duration::from_secs(secs), || {
ic_cdk::spawn(async move {
let (height, current) = crate::highest_block();
match get_best_from_rpc().await {
Ok((best, _)) => {
if height + REQUIRED_CONFIRMATIONS >= best {
sync(120);
} else {
match updater::get_block(height + 1).await {
Ok(block) => {
if block.header.prev_blockhash != current {
sync(300);
return;
}
if let Err(e) = updater::index_block(height + 1, block).await {
sync(3);
}
Err(e) => {
sync(5);
}
}
}}
Err(e) => {
sync(5);
}
}
});
});
}
Is this timer causing the problem?