Skip to content

Commit

Permalink
Update canisters post release (#6668)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Oct 24, 2024
1 parent d61a82f commit 139f5b6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
2 changes: 2 additions & 0 deletions backend/canisters/local_group_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1410](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1410-local_group_index)] - 2024-10-24

### Added

- Expose count of Group/Community canisters per build version ([#6659](https://github.com/open-chat-labs/open-chat/pull/6659))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1411](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1411-local_user_index)] - 2024-10-24

### Added

- Add an error log with http endpoint ([#6608](https://github.com/open-chat-labs/open-chat/pull/6608))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/user/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1412](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1414-user)] - 2024-10-24

### Added

- Copy chat events into stable memory ([#6603](https://github.com/open-chat-labs/open-chat/pull/6603))
Expand Down
4 changes: 0 additions & 4 deletions backend/canisters/user/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,8 @@ struct Data {
pub rng_seed: [u8; 32],
pub referred_by: Option<UserId>,
pub referrals: Referrals,
// TODO: Remove skip_deserializing after release
#[serde(default, skip_deserializing)]
pub message_activity_events: MessageActivityEvents,
#[serde(default)]
stable_memory_event_migration_complete: bool,
#[serde(default)]
stable_memory_keys_to_garbage_collect: Vec<KeyPrefix>,
}

Expand Down
10 changes: 3 additions & 7 deletions backend/canisters/user/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
for chat in data.direct_chats.iter_mut() {
chat.events.set_stable_memory_key_prefixes();
}
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);
canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
init_state(env, data, args.wasm_version);
Expand Down
7 changes: 0 additions & 7 deletions backend/libraries/chat_events/src/chat_events_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::stable_storage::ChatEventsStableStorage;
use crate::{
ChatEventInternal, ChatEventsMap, ChatInternal, EventKey, EventOrExpiredRangeInternal, EventsMap, MessageInternal,
};
use candid::Principal;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::collections::hash_map::Entry::Vacant;
Expand All @@ -17,20 +16,14 @@ use types::{
#[derive(Serialize, Deserialize)]
pub struct ChatEventsList {
events_map: ChatEventsMap,
#[serde(default = "default_state_events_map")]
stable_events_map: ChatEventsStableStorage,
message_id_map: HashMap<MessageId, EventIndex>,
message_event_indexes: Vec<EventIndex>,
latest_event_index: Option<EventIndex>,
latest_event_timestamp: Option<TimestampMillis>,
#[serde(default)]
read_events_from_stable_memory: bool,
}

fn default_state_events_map() -> ChatEventsStableStorage {
ChatEventsStableStorage::new(Chat::Direct(Principal::anonymous().into()), None)
}

impl ChatEventsList {
pub fn set_stable_memory_prefix(&mut self, chat: Chat, thread_root_message_index: Option<MessageIndex>) {
self.stable_events_map = ChatEventsStableStorage::new(chat, thread_root_message_index);
Expand Down

0 comments on commit 139f5b6

Please sign in to comment.