Skip to content

Commit

Permalink
Reduce proposal update frequency on test env to reduce cycles cost (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Dec 5, 2024
1 parent 3785a85 commit 8fa599b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/canisters/proposals_bot/impl/src/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) fn start(state: &RuntimeState) {
check_for_nervous_system_updates::start_job();
increase_dissolve_delay::start_job_if_required(state);
push_proposals::start_job_if_required(state);
retrieve_proposals::start_job();
retrieve_proposals::start_job(state);
update_finished_proposals::start_job_if_required(state);
update_proposals::start_job_if_required(state);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ use nns_governance_canister::types::{ListProposalInfo, ProposalInfo};
use sns_governance_canister::types::ProposalData;
use std::collections::HashSet;
use std::time::Duration;
use types::{CanisterId, Milliseconds, Proposal};
use types::{CanisterId, Proposal};

pub const NNS_TOPIC_NEURON_MANAGEMENT: i32 = 1;
pub const NNS_TOPIC_EXCHANGE_RATE: i32 = 2;

const BATCH_SIZE_LIMIT: u32 = 50;
const RETRIEVE_PROPOSALS_INTERVAL: Milliseconds = MINUTE_IN_MS;

const NNS_TOPIC_NETWORK_ECONOMICS: i32 = 3;
const NNS_TOPIC_GOVERNANCE: i32 = 4;
Expand All @@ -26,8 +25,9 @@ const NNS_TOPICS_TO_PUSH_SNS_PROPOSALS_FOR: [i32; 3] = [
NNS_TOPIC_SNS_AND_NEURON_FUND,
];

pub fn start_job() {
ic_cdk_timers::set_timer_interval(Duration::from_millis(RETRIEVE_PROPOSALS_INTERVAL), run);
pub fn start_job(state: &RuntimeState) {
let interval = Duration::from_millis(if state.data.test_mode { 30 * MINUTE_IN_MS } else { MINUTE_IN_MS });
ic_cdk_timers::set_timer_interval(interval, run);
}

pub fn run() {
Expand Down

0 comments on commit 8fa599b

Please sign in to comment.