timeline queue refactoring: address review comments

This commit is contained in:
Benjamin Bouvier
2024-05-20 11:06:39 +02:00
parent 9575ee92d4
commit 5df53d7338
3 changed files with 9 additions and 6 deletions

View File

@@ -723,7 +723,11 @@ impl<P: RoomDataProvider> TimelineInner<P> {
// reflected in the timeline, so we set all other pending events to
// cancelled.
//
// TODO(bnjbvr): spooky action at a distance here^
// TODO(bnjbvr): spooky action at a distance here^. The sending task is the one
// deciding to clear the sending queue, so we're updating based on that implicit
// knowledge here. Instead, the sending queue should notify the timeline that
// it's deciding to not send those messages, and then only the
// timeline should mark these items as cancelled.
let items = &mut txn.items;
let num_items = items.len();
for idx in 0..num_items {

View File

@@ -586,7 +586,7 @@ impl Timeline {
| TimelineItemContent::ProfileChange(_)
| TimelineItemContent::OtherState(_)
| TimelineItemContent::CallInvite => {
error_return!("Retrying state events/call invite is not currently supported");
error_return!("Retrying state events/call invites is not currently supported");
}
TimelineItemContent::FailedToParseMessageLike { .. }
| TimelineItemContent::FailedToParseState { .. } => {

View File

@@ -115,7 +115,9 @@ async fn send_or_queue_msg(
return;
}
if room.state() != RoomState::Joined {
if room.state() == RoomState::Joined {
send_task.start(room, msg);
} else {
info!("Refusing to send message, room is not joined");
timeline
.update_event_send_state(
@@ -126,10 +128,7 @@ async fn send_or_queue_msg(
},
)
.await;
return;
}
send_task.start(room, msg);
}
async fn handle_send_result(