mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Don't fail on invalid stripped state entries during migration
This commit is contained in:
@@ -3,6 +3,7 @@ use std::{cmp, collections::HashMap, future::ready};
|
|||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Event, Pdu, Result, debug, debug_info, debug_warn, err, error, info,
|
Err, Event, Pdu, Result, debug, debug_info, debug_warn, err, error, info,
|
||||||
result::NotFound,
|
result::NotFound,
|
||||||
|
trace,
|
||||||
utils::{
|
utils::{
|
||||||
IterStream, ReadyExt,
|
IterStream, ReadyExt,
|
||||||
stream::{TryExpect, TryIgnore},
|
stream::{TryExpect, TryIgnore},
|
||||||
@@ -802,7 +803,18 @@ async fn fix_local_invite_state(services: &Services) -> Result {
|
|||||||
let fixed = userroomid_invitestate.stream()
|
let fixed = userroomid_invitestate.stream()
|
||||||
// if they're a local user on this homeserver
|
// if they're a local user on this homeserver
|
||||||
.try_filter(|((user_id, _), _): &KeyVal<'_>| ready(services.globals.user_is_local(user_id)))
|
.try_filter(|((user_id, _), _): &KeyVal<'_>| ready(services.globals.user_is_local(user_id)))
|
||||||
.and_then(async |((user_id, room_id), stripped_state): KeyVal<'_>| Ok::<_, conduwuit::Error>((user_id.to_owned(), room_id.to_owned(), stripped_state.deserialize()?)))
|
.and_then(async |((user_id, room_id), stripped_state): KeyVal<'_>| Ok::<_,
|
||||||
|
conduwuit::Error>((user_id.to_owned(), room_id.to_owned(), stripped_state.deserialize
|
||||||
|
().unwrap_or_else(|e| {
|
||||||
|
trace!("Failed to deserialize: {:?}", stripped_state.json());
|
||||||
|
warn!(
|
||||||
|
%user_id,
|
||||||
|
%room_id,
|
||||||
|
"Failed to deserialize stripped state for invite, removing from db: {e}"
|
||||||
|
);
|
||||||
|
userroomid_invitestate.del((user_id, room_id));
|
||||||
|
vec![]
|
||||||
|
}))))
|
||||||
.try_fold(0_usize, async |mut fixed, (user_id, room_id, stripped_state)| {
|
.try_fold(0_usize, async |mut fixed, (user_id, room_id, stripped_state)| {
|
||||||
// and their invite state is None
|
// and their invite state is None
|
||||||
if stripped_state.is_empty()
|
if stripped_state.is_empty()
|
||||||
|
|||||||
Reference in New Issue
Block a user