From 6819115d475a3386f7ad2a1bc600fe4048ae70ff Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 19 Dec 2024 11:55:50 +0000 Subject: [PATCH] Fix notifications index canisterId in already running job (#7089) --- backend/canisters/registry/CHANGELOG.md | 2 ++ .../registry/impl/src/lifecycle/post_upgrade.rs | 9 +-------- backend/canisters/registry/impl/src/timer_job_types.rs | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/canisters/registry/CHANGELOG.md b/backend/canisters/registry/CHANGELOG.md index 0814474012..9a0d6ee194 100644 --- a/backend/canisters/registry/CHANGELOG.md +++ b/backend/canisters/registry/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1535](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1535-registry)] - 2024-12-19 + ### Fixed - Fix notifications index canisterId ([#7088](https://github.com/open-chat-labs/open-chat/pull/7088)) diff --git a/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs index b74c5e5655..2b1c02e4ab 100644 --- a/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs @@ -7,7 +7,6 @@ use ic_cdk::post_upgrade; use registry_canister::post_upgrade::Args; use stable_memory::get_reader; use tracing::info; -use types::CanisterId; use utils::cycles::init_cycles_dispenser_client; #[post_upgrade] @@ -16,15 +15,9 @@ fn post_upgrade(args: Args) { let memory = get_upgrades_memory(); let reader = get_reader(&memory); - let (mut data, errors, logs, traces): (Data, Vec, Vec, Vec) = + let (data, errors, logs, traces): (Data, Vec, Vec, Vec) = msgpack::deserialize(reader).unwrap(); - if data.test_mode { - data.notifications_index_canister_id = CanisterId::from_text("7ekiy-aiaaa-aaaaf-ab2dq-cai").unwrap(); - } else { - data.notifications_index_canister_id = CanisterId::from_text("4glvk-ryaaa-aaaaf-aaaia-cai").unwrap(); - } - canister_logger::init_with_logs(data.test_mode, errors, logs, traces); let env = init_env(data.rng_seed); diff --git a/backend/canisters/registry/impl/src/timer_job_types.rs b/backend/canisters/registry/impl/src/timer_job_types.rs index 431b6a20b6..e246e20f78 100644 --- a/backend/canisters/registry/impl/src/timer_job_types.rs +++ b/backend/canisters/registry/impl/src/timer_job_types.rs @@ -23,6 +23,7 @@ pub struct ExpandOntoSubnetJob { pub this_canister_id: CanisterId, pub user_index: CanisterId, pub group_index: CanisterId, + #[serde(skip_deserializing, default = "notifications_index")] pub notifications_index: CanisterId, pub event_relay: CanisterId, pub cycles_dispenser: CanisterId, @@ -31,6 +32,10 @@ pub struct ExpandOntoSubnetJob { pub create_canister_block_index: Option, } +fn notifications_index() -> CanisterId { + CanisterId::from_text("4glvk-ryaaa-aaaaf-aaaia-cai").unwrap() +} + impl Job for TimerJob { fn execute(self) { match self {