From 3f1a40a7d1a0847dec2b10560e6b4f48131504cf Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Fri, 3 Jul 2020 10:31:47 +0200 Subject: [PATCH] Add a bunch of FIXMEs to have receive_* methods do the emitting. --- matrix_sdk_base/src/client.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index 2e72b95b..af6282d5 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -977,6 +977,8 @@ impl BaseClient { } if let Ok(e) = event.deserialize() { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if self.receive_joined_state_event(&room_id, &e).await? { updated = true; } @@ -1016,6 +1018,8 @@ impl BaseClient { .set_unread_notice_count(&joined_room.unread_notifications); for mut event in &mut joined_room.timeline.events { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. let timeline_update = self .receive_joined_timeline_event(room_id, &mut event) .await?; @@ -1042,6 +1046,8 @@ impl BaseClient { if let Some(account_data) = &joined_room.account_data { for account_data in &account_data.events { { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if let Ok(e) = account_data.deserialize() { if self.receive_account_data_event(&room_id, &e).await { updated = true; @@ -1058,6 +1064,8 @@ impl BaseClient { // efficient but we need a room_id so we would loop through now or later. for presence in &mut response.presence.events { { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if let Ok(e) = presence.deserialize() { if self.receive_presence_event(&room_id, &e).await { updated = true; @@ -1072,6 +1080,8 @@ impl BaseClient { for ephemeral in &mut joined_room.ephemeral.events { { if let Ok(e) = ephemeral.deserialize() { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if self.receive_ephemeral_event(&room_id, &e).await { updated = true; } @@ -1107,6 +1117,8 @@ impl BaseClient { *event = e; } + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if let Ok(e) = event.deserialize() { if self.receive_left_state_event(&room_id, &e).await? { updated = true; @@ -1131,6 +1143,8 @@ impl BaseClient { *event = e; } + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if self.receive_left_timeline_event(room_id, &event).await? { updated = true; }; @@ -1161,6 +1175,8 @@ impl BaseClient { let matrix_room = { for event in &invited_room.invite_state.events { if let Ok(e) = event.deserialize() { + // FIXME: receive_* and emit_* methods shouldn't be called in parallel. We + // should only pass events to receive_* methods and then let *them* emit. if self.receive_invite_state_event(&room_id, &e).await? { updated = true; }