Skip to content

Commit

Permalink
Fix calculation to determine if a canister needs a cycles top up (#6799)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Nov 12, 2024
1 parent 47b1010 commit ce1924a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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
6 changes: 6 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Fixed

- Fix calculation to determine if a canister needs a cycles top up ([#6799](https://github.com/open-chat-labs/open-chat/pull/6799))

## [[2.0.1444](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1444-local_user_index)] - 2024-11-12

### Added

- Add job to check cycles balances of child canisters every week ([#6796](https://github.com/open-chat-labs/open-chat/pull/6796))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 ce1924a

Please sign in to comment.