Skip to content

Commit

Permalink
Continue migration to stable memory now that reserved cycles limit in…
Browse files Browse the repository at this point in the history
…creased
  • Loading branch information
hpeebles committed Dec 9, 2024
1 parent 5850cbb commit 91ad68d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions backend/canisters/community/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ struct Data {
expiring_member_actions: ExpiringMemberActions,
user_cache: UserCache,
user_event_sync_queue: GroupedTimerJobQueue<UserEventBatch>,
#[serde(default)]
stable_memory_keys_to_garbage_collect: Vec<KeyPrefix>,
#[serde(skip_deserializing)]
members_migrated_to_stable_memory: bool,
#[serde(default)]
bot_permissions: BTreeMap<UserId, SlashCommandPermissions>,
Expand Down
11 changes: 9 additions & 2 deletions backend/canisters/community/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::jobs::import_groups::finalize_group_import;
use crate::lifecycle::{init_env, init_state};
use crate::memory::{get_stable_memory_map_memory, get_upgrades_memory};
use crate::timer_job_types::MigrateMembersToStableMemoryJob;
use crate::{read_state, Data};
use crate::timer_job_types::{MigrateMembersToStableMemoryJob, TimerJob};
use crate::{mutate_state, read_state, Data};
use canister_logger::LogEntry;
use canister_timer_jobs::Job;
use canister_tracing_macros::trace;
Expand Down Expand Up @@ -54,5 +54,12 @@ fn post_upgrade(args: Args) {
.record_instructions_count(InstructionCountFunctionId::PostUpgrade, now)
});

mutate_state(|state| {
state
.data
.timer_jobs
.cancel_jobs(|j| matches!(j, TimerJob::MigrateMembersToStableMemory(_)));
});

MigrateMembersToStableMemoryJob.execute();
}
2 changes: 0 additions & 2 deletions backend/canisters/community/impl/src/model/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ pub struct CommunityMembers {
members_with_display_names: BTreeSet<UserId>,
members_with_referrals: BTreeSet<UserId>,
updates: BTreeSet<(TimestampMillis, UserId, MemberUpdate)>,
#[serde(skip_deserializing)]
migrate_to_stable_memory_queue: VecDeque<UserId>,
#[serde(skip_deserializing)]
migration_to_stable_memory_complete: bool,
}

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/group/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ struct Data {
expiring_member_actions: ExpiringMemberActions,
user_cache: UserCache,
user_event_sync_queue: GroupedTimerJobQueue<UserEventBatch>,
#[serde(skip_deserializing)]
members_migrated_to_stable_memory: bool,
stable_memory_keys_to_garbage_collect: Vec<KeyPrefix>,
#[serde(default)]
Expand Down
2 changes: 0 additions & 2 deletions backend/libraries/group_chat_core/src/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ pub struct GroupMembers {
suspended: BTreeSet<UserId>,
updates: BTreeSet<(TimestampMillis, UserId, MemberUpdate)>,
latest_update_removed: TimestampMillis,
#[serde(skip_deserializing)]
migrate_to_stable_memory_queue: VecDeque<UserId>,
#[serde(skip_deserializing)]
migration_to_stable_memory_complete: bool,
}

Expand Down

0 comments on commit 91ad68d

Please sign in to comment.