Skip to content

Commit

Permalink
Fix calculation to determine if a canister needs a cycles top up
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Nov 12, 2024
1 parent 79d563b commit 6740d0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn next(state: &mut RuntimeState) -> Option<CanisterId> {
async fn run_async(canister_id: CanisterId) {
match ic_cdk::api::management_canister::main::canister_status(CanisterIdRecord { canister_id }).await {
Ok((status,)) => {
if status.cycles < Nat::from(2u32) * status.settings.freezing_threshold {
if status.cycles < Nat::from(60u32) * status.idle_cycles_burned_per_day {
top_up_canister(Some(canister_id)).await;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn run_async(user_id: UserId) {
.await
{
Ok((status,)) => {
if status.cycles < Nat::from(2u32) * status.settings.freezing_threshold {
if status.cycles < Nat::from(60u32) * status.idle_cycles_burned_per_day {
top_up_user(Some(user_id)).await;
}
}
Expand Down

0 comments on commit 6740d0e

Please sign in to comment.