Skip to content

Commit

Permalink
Revert User canister cycles top-ups back to 0.2T (#6843)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Nov 18, 2024
1 parent fd312b4 commit 5344852
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Pass in `bot_api_gateway` when installing User canisters ([#6842](https://github.com/open-chat-labs/open-chat/pull/6842))
- Revert User canister cycles top-ups back to 0.2T ([#6843](https://github.com/open-chat-labs/open-chat/pull/6843))

## [[2.0.1458](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1458-local_user_index)] - 2024-11-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub(crate) async fn run_async(user_id: UserId) {
if status.cycles < utils::cycles::MIN_CYCLES_BALANCE
|| status.cycles < Nat::from(60u32) * status.idle_cycles_burned_per_day
{
top_up_user(Some(user_id), Some(20_000_000_000)).await;
top_up_user(Some(user_id)).await;
}
}
Err(error) => error!(%user_id, ?error, "Error getting canister status"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl TimerJobItem for UserEventBatch {
Ok(user_canister::c2c_notify_events::Response::Success) => Ok(()),
Err((code, msg)) => {
if is_out_of_cycles_error(code, &msg) {
top_up_user(Some(self.user_id), None).await;
top_up_user(Some(self.user_id)).await;
}
let retry = should_retry_failed_c2c_call(code, &msg);
Err(retry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use utils::cycles::can_spend_cycles;
#[update(guard = "caller_is_local_user_canister", msgpack = true)]
#[trace]
async fn c2c_notify_low_balance(_args: NotifyLowBalanceArgs) -> NotifyLowBalanceResponse {
top_up_user(None, None).await
top_up_user(None).await
}

pub(crate) async fn top_up_user(user_id: Option<UserId>, amount: Option<Cycles>) -> NotifyLowBalanceResponse {
let prepare_ok = match read_state(|state| prepare(user_id, amount.unwrap_or(USER_CANISTER_TOP_UP_AMOUNT), state)) {
pub(crate) async fn top_up_user(user_id: Option<UserId>) -> NotifyLowBalanceResponse {
let prepare_ok = match read_state(|state| prepare(user_id, USER_CANISTER_TOP_UP_AMOUNT, state)) {
Ok(ok) => ok,
Err(response) => return response,
};
Expand Down

0 comments on commit 5344852

Please sign in to comment.