fix: fetch event multiple times

This commit is contained in:
Timo Kösters 2021-08-14 23:29:25 +02:00
parent f9a2edc0dd
commit 5bd5b41c70
No known key found for this signature in database
GPG key ID: 356E705610F626D5
2 changed files with 14 additions and 9 deletions

View file

@ -845,10 +845,7 @@ impl Rooms {
}
/// Returns the json of a pdu.
pub fn get_outlier_pdu_json(
&self,
event_id: &EventId,
) -> Result<Option<CanonicalJsonObject>> {
pub fn get_outlier_pdu_json(&self, event_id: &EventId) -> Result<Option<CanonicalJsonObject>> {
self.eventid_outlierpdu
.get(event_id.as_bytes())?
.map(|pdu| {
@ -1134,10 +1131,9 @@ impl Rooms {
&serde_json::to_vec(&pdu_json).expect("CanonicalJsonObject is always a valid"),
)?;
// This also replaces the eventid of any outliers with the correct
// pduid, removing the place holder.
self.eventid_pduid
.insert(pdu.event_id.as_bytes(), &pdu_id)?;
self.eventid_outlierpdu.remove(pdu.event_id.as_bytes())?;
drop(insert_lock);