mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-09 06:31:05 +01:00
fix: state bug
This commit is contained in:
parent
80533bfab2
commit
f121978897
2 changed files with 7 additions and 13 deletions
|
@ -165,9 +165,8 @@ impl Sending {
|
||||||
let new_events = guard.sending.servernamepduids
|
let new_events = guard.sending.servernamepduids
|
||||||
.scan_prefix(prefix.clone())
|
.scan_prefix(prefix.clone())
|
||||||
.filter_map(|(k, _)| {
|
.filter_map(|(k, _)| {
|
||||||
Self::parse_servercurrentevent(&k).ok()
|
Self::parse_servercurrentevent(&k).ok().map(|ev| (ev, k))
|
||||||
})
|
})
|
||||||
.map(|(_, event)| event)
|
|
||||||
.take(30)
|
.take(30)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -175,16 +174,9 @@ impl Sending {
|
||||||
|
|
||||||
if !new_events.is_empty() {
|
if !new_events.is_empty() {
|
||||||
// Insert pdus we found
|
// Insert pdus we found
|
||||||
for event in &new_events {
|
for (_, key) in &new_events {
|
||||||
let mut current_key = prefix.clone();
|
guard.sending.servercurrentevents.insert(&key, &[]).unwrap();
|
||||||
match event {
|
guard.sending.servernamepduids.remove(&key).unwrap();
|
||||||
SendingEventType::Pdu(b) |
|
|
||||||
SendingEventType::Edu(b) => {
|
|
||||||
current_key.extend_from_slice(&b);
|
|
||||||
guard.sending.servercurrentevents.insert(¤t_key, &[]).unwrap();
|
|
||||||
guard.sending.servernamepduids.remove(¤t_key).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
@ -192,7 +184,7 @@ impl Sending {
|
||||||
futures.push(
|
futures.push(
|
||||||
Self::handle_events(
|
Self::handle_events(
|
||||||
outgoing_kind.clone(),
|
outgoing_kind.clone(),
|
||||||
new_events,
|
new_events.into_iter().map(|(event, _)| event.1).collect(),
|
||||||
Arc::clone(&db),
|
Arc::clone(&db),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1058,6 +1058,8 @@ pub fn handle_incoming_pdu<'a>(
|
||||||
if let Some(state_key) = &prev_pdu.state_key {
|
if let Some(state_key) = &prev_pdu.state_key {
|
||||||
state.insert((prev_pdu.kind.clone(), state_key.clone()), prev_pdu);
|
state.insert((prev_pdu.kind.clone(), state_key.clone()), prev_pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state_at_incoming_event = Some(state);
|
||||||
}
|
}
|
||||||
// TODO: set incoming_auth_events?
|
// TODO: set incoming_auth_events?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue