Starts the fund manager service setting it up to monitor the upgrader canister cycles and top it up if needed.
(upgrader_id: Principal, cycle_obtain_strategy: &CycleObtainStrategy)
| 1261 | |
| 1262 | /// Starts the fund manager service setting it up to monitor the upgrader canister cycles and top it up if needed. |
| 1263 | pub fn init_cycle_monitor(upgrader_id: Principal, cycle_obtain_strategy: &CycleObtainStrategy) { |
| 1264 | let fund_strategy = MonitorExternalCanisterStrategy::BelowEstimatedRuntime( |
| 1265 | MonitoringExternalCanisterEstimatedRuntimeInput { |
| 1266 | min_runtime_secs: 60 * 24 * 60 * 60, // 60 days |
| 1267 | fund_runtime_secs: 30 * 24 * 60 * 60, // 30 days |
| 1268 | max_runtime_cycles_fund: 2_000_000_000_000, |
| 1269 | fallback_min_cycles: 600_000_000_000, |
| 1270 | fallback_fund_cycles: 300_000_000_000, |
| 1271 | }, |
| 1272 | ); |
| 1273 | |
| 1274 | CYCLE_MANAGER.set_global_cycle_obtain_strategy(cycle_obtain_strategy); |
| 1275 | CYCLE_MANAGER.add_canister(id(), fund_strategy.clone(), None); |
| 1276 | CYCLE_MANAGER.add_canister(upgrader_id, fund_strategy.clone(), None); |
| 1277 | |
| 1278 | EXTERNAL_CANISTER_SERVICE.canister_monitor_restart(); |
| 1279 | |
| 1280 | CYCLE_MANAGER.start(); |
| 1281 | } |
| 1282 | } |
| 1283 | |
| 1284 | #[cfg(test)] |
no test coverage detected