improvement: refactor state res and fix a few bugs in the process

This commit is contained in:
Timo Kösters 2021-03-25 23:55:40 +01:00
parent 16eed1d8c2
commit c213769d9f
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
8 changed files with 651 additions and 833 deletions

View file

@ -1,5 +1,6 @@
use super::State;
use crate::{ConduitResult, Database, Error, Ruma};
use log::error;
use ruma::{
api::client::r0::sync::sync_events,
events::{room::member::MembershipState, AnySyncEphemeralRoomEvent, EventType},
@ -505,7 +506,10 @@ pub async fn sync_events_route(
db.rooms
.pdu_shortstatehash(&pdu.1.event_id)
.ok()?
.ok_or_else(|| Error::bad_database("Pdu in db doesn't have a state hash."))
.ok_or_else(|| {
error!("{:?}", pdu.1);
Error::bad_database("Pdu in db doesn't have a state hash.")
})
.ok()
})
.and_then(|shortstatehash| {