ignore errors instead of expecting for state gathering

Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
June Clementine Strawberry 2025-03-02 23:11:43 -05:00
parent dca7bf9635
commit 17e0384eeb
No known key found for this signature in database

View file

@ -4,7 +4,7 @@ use conduwuit::{
PduEvent, Result, StateKey, at, err, implement, pair_of, PduEvent, Result, StateKey, at, err, implement, pair_of,
utils::{ utils::{
result::FlatOk, result::FlatOk,
stream::{BroadbandExt, IterStream, ReadyExt, TryExpect}, stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore},
}, },
}; };
use database::Deserialized; use database::Deserialized;
@ -232,7 +232,7 @@ pub fn state_keys_with_shortids<'a>(
) -> impl Stream<Item = (StateKey, ShortEventId)> + Send + 'a { ) -> impl Stream<Item = (StateKey, ShortEventId)> + Send + 'a {
let short_ids = self let short_ids = self
.state_full_shortids(shortstatehash) .state_full_shortids(shortstatehash)
.expect_ok() .ignore_err()
.unzip() .unzip()
.map(|(ssks, sids): (Vec<u64>, Vec<u64>)| (ssks, sids)) .map(|(ssks, sids): (Vec<u64>, Vec<u64>)| (ssks, sids))
.shared(); .shared();
@ -269,7 +269,7 @@ pub fn state_keys<'a>(
) -> impl Stream<Item = StateKey> + Send + 'a { ) -> impl Stream<Item = StateKey> + Send + 'a {
let short_ids = self let short_ids = self
.state_full_shortids(shortstatehash) .state_full_shortids(shortstatehash)
.expect_ok() .ignore_err()
.map(at!(0)); .map(at!(0));
self.services self.services
@ -305,7 +305,7 @@ pub fn state_added(
.map_ok(|(a, b)| b.difference(&a).copied().collect::<Vec<_>>()) .map_ok(|(a, b)| b.difference(&a).copied().collect::<Vec<_>>())
.map_ok(IterStream::try_stream) .map_ok(IterStream::try_stream)
.try_flatten_stream() .try_flatten_stream()
.expect_ok() .ignore_err()
.map(parse_compressed_state_event) .map(parse_compressed_state_event)
} }
@ -327,7 +327,7 @@ pub fn state_full_pdus(
) -> impl Stream<Item = PduEvent> + Send + '_ { ) -> impl Stream<Item = PduEvent> + Send + '_ {
let short_ids = self let short_ids = self
.state_full_shortids(shortstatehash) .state_full_shortids(shortstatehash)
.expect_ok() .ignore_err()
.map(at!(1)); .map(at!(1));
self.services self.services
@ -352,7 +352,7 @@ where
{ {
let shortids = self let shortids = self
.state_full_shortids(shortstatehash) .state_full_shortids(shortstatehash)
.expect_ok() .ignore_err()
.unzip() .unzip()
.shared(); .shared();