-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reclaim cycles from available canisters as well (#466)
- Loading branch information
1 parent
eac8b32
commit 54067ab
Showing
2 changed files
with
32 additions
and
16 deletions.
There are no files selected for viewing
23 changes: 15 additions & 8 deletions
23
...rchestrator/src/api/cycle_management/start_reclaiming_cycles_from_individual_canisters.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
|
||
use ic_cdk_macros::update; | ||
|
||
use crate::{guard::is_caller::is_caller_global_admin_or_controller, CANISTER_DATA}; | ||
|
||
#[update(guard = "is_caller_global_admin_or_controller")] | ||
fn start_reclaiming_cycles_from_individual_canisters() -> Result<String, String>{ | ||
fn start_reclaiming_cycles_from_individual_canisters() -> Result<String, String> { | ||
CANISTER_DATA.with_borrow(|canister_data| { | ||
canister_data.all_subnet_orchestrator_canisters_list.iter().for_each(|subnet_orchestrator_id| { | ||
ic_cdk::notify(*subnet_orchestrator_id, "reclaim_cycles_from_individual_canisters", ()).unwrap(); | ||
}); | ||
}); | ||
Ok("Success".into()) | ||
} | ||
canister_data | ||
.all_subnet_orchestrator_canisters_list | ||
.iter() | ||
.for_each(|subnet_orchestrator_id| { | ||
ic_cdk::notify( | ||
*subnet_orchestrator_id, | ||
"reclaim_cycles_from_individual_canisters", | ||
(), | ||
) | ||
.unwrap(); | ||
}); | ||
}); | ||
Ok("Success".into()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters