fix: don't panic on missing events in state
This commit is contained in:
parent
68227c06c3
commit
d1e5acd7b3
1 changed files with 10 additions and 8 deletions
|
@ -55,7 +55,7 @@ use std::{
|
||||||
time::{Duration, Instant, SystemTime},
|
time::{Duration, Instant, SystemTime},
|
||||||
};
|
};
|
||||||
|
|
||||||
use tracing::{info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
/// Wraps either an literal IP address plus port, or a hostname plus complement
|
/// Wraps either an literal IP address plus port, or a hostname plus complement
|
||||||
/// (colon-plus-port if it was specified).
|
/// (colon-plus-port if it was specified).
|
||||||
|
@ -1149,16 +1149,18 @@ pub async fn get_room_state_route(
|
||||||
|
|
||||||
Ok(get_room_state::v1::Response {
|
Ok(get_room_state::v1::Response {
|
||||||
auth_chain: auth_chain_ids
|
auth_chain: auth_chain_ids
|
||||||
.map(|id| {
|
.filter_map(|id| {
|
||||||
services()
|
match services()
|
||||||
.rooms
|
.rooms
|
||||||
.timeline
|
.timeline
|
||||||
.get_pdu_json(&id)
|
.get_pdu_json(&id).ok()? {
|
||||||
.map(|maybe_json| {
|
Some(json) => Some(PduEvent::convert_to_outgoing_federation_event(json)),
|
||||||
PduEvent::convert_to_outgoing_federation_event(maybe_json.unwrap())
|
None => {
|
||||||
|
error!("Could not find event json for {id} in db.");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
.filter_map(|r| r.ok())
|
|
||||||
.collect(),
|
.collect(),
|
||||||
pdus,
|
pdus,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue