Add ability to update room leaves with multiple eventIds

Tokio seems a bit broken with Rocket...
This commit is contained in:
Devin Ragotzy 2021-01-18 19:41:38 -05:00
parent 00436a32b0
commit 3a6f264450
3 changed files with 22 additions and 24 deletions

View file

@ -24,7 +24,7 @@ use ruma::{
};
use state_res::{Event, EventMap, StateMap};
use std::{
collections::{BTreeMap, BTreeSet, HashSet},
collections::{BTreeMap, BTreeSet},
convert::TryFrom,
fmt::Debug,
future::Future,
@ -1245,13 +1245,10 @@ fn append_state(db: &Database, pdu: &PduEvent, new_room_leaves: &[EventId]) -> R
utils::to_canonical_object(pdu).expect("Pdu is valid canonical object"),
count,
pdu_id.clone().into(),
&new_room_leaves,
&db,
)?;
// If we update the room leaves after calling append_pdu it will stick since append_pdu
// calls replace_pdu_leaves with only the given event.
db.rooms.force_pdu_leaves(pdu.room_id(), new_room_leaves)?;
// We set the room state after inserting the pdu, so that we never have a moment in time
// where events in the current room state do not exist
db.rooms.set_room_state(&pdu.room_id, &statehashid)?;