diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index aa597606d5..43e4223b59 100644 --- a/backend/canisters/local_user_index/CHANGELOG.md +++ b/backend/canisters/local_user_index/CHANGELOG.md @@ -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 diff --git a/backend/canisters/local_user_index/impl/src/jobs/topup_canisters.rs b/backend/canisters/local_user_index/impl/src/jobs/topup_canisters.rs index 97ab649cd0..3fcb601a2a 100644 --- a/backend/canisters/local_user_index/impl/src/jobs/topup_canisters.rs +++ b/backend/canisters/local_user_index/impl/src/jobs/topup_canisters.rs @@ -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"), diff --git a/backend/canisters/local_user_index/impl/src/model/user_event_batch.rs b/backend/canisters/local_user_index/impl/src/model/user_event_batch.rs index d96e15dcde..cb15a46a3e 100644 --- a/backend/canisters/local_user_index/impl/src/model/user_event_batch.rs +++ b/backend/canisters/local_user_index/impl/src/model/user_event_batch.rs @@ -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) diff --git a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs index a07b4fb0b6..ecfd363ea1 100644 --- a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs +++ b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs @@ -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, amount: Option) -> 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) -> NotifyLowBalanceResponse { + let prepare_ok = match read_state(|state| prepare(user_id, USER_CANISTER_TOP_UP_AMOUNT, state)) { Ok(ok) => ok, Err(response) => return response, };