Skip to content

Commit

Permalink
Increase reserved cycles limit for the Windoge98 community (#6732)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Nov 6, 2024
1 parent 91c3117 commit e3a6b25
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/canisters/local_group_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Increase the max cycles required during upgrades ([#6725](https://github.com/open-chat-labs/open-chat/pull/6725))
- Increase size of cycles top-ups ([#6727](https://github.com/open-chat-labs/open-chat/pull/6727))
- Temporarily disable job to trigger event migration ([#6730](https://github.com/open-chat-labs/open-chat/pull/6730))
- Increase reserved cycles limit for the Windoge98 community ([#6732](https://github.com/open-chat-labs/open-chat/pull/6732))

## [[2.0.1410](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1410-local_group_index)] - 2024-10-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ use crate::Data;
use candid::Principal;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::api::management_canister::main::{CanisterSettings, UpdateSettingsArgument};
use ic_cdk::post_upgrade;
use local_group_index_canister::post_upgrade::Args;
use stable_memory::get_reader;
use std::time::Duration;
use tracing::info;
use types::CanisterId;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -28,9 +31,25 @@ fn post_upgrade(args: Args) {
.chain(data.local_communities.iter().map(|(c, _)| Principal::from(*c)))
.collect();

if !data.test_mode {
ic_cdk_timers::set_timer(Duration::ZERO, || ic_cdk::spawn(increase_reserved_cycles_limit()));
}

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
init_state(env, data, args.wasm_version);

info!(version = %args.wasm_version, "Post-upgrade complete");
}

async fn increase_reserved_cycles_limit() {
ic_cdk::api::management_canister::main::update_settings(UpdateSettingsArgument {
canister_id: CanisterId::from_text("ow6el-gyaaa-aaaar-av5na-cai").unwrap(),
settings: CanisterSettings {
reserved_cycles_limit: Some(10_000_000_000_000u128.into()),
..Default::default()
},
})
.await
.unwrap();
}

0 comments on commit e3a6b25

Please sign in to comment.