add status_update_serial to webxdc_status_update event (#3215)

this bypasses the replication safety introduced by letting the caller track the last serial,
however, in case of bots that do not track much state and do not playback updates anyway,
it is still useful.
This commit is contained in:
bjoern
2022-04-14 11:12:17 +02:00
committed by GitHub
parent 3c75b36148
commit b2e9e57859
5 changed files with 32 additions and 11 deletions

View File

@@ -254,9 +254,14 @@ impl Context {
)
.await?;
self.emit_event(EventType::WebxdcStatusUpdate(instance.id));
let status_update_serial = StatusUpdateSerial(u32::try_from(rowid)?);
Ok(StatusUpdateSerial(u32::try_from(rowid)?))
self.emit_event(EventType::WebxdcStatusUpdate {
msg_id: instance.id,
status_update_serial,
});
Ok(status_update_serial)
}
/// Sends a status update for an webxdc instance.
@@ -1016,7 +1021,10 @@ mod tests {
.get_matching(|evt| matches!(evt, EventType::WebxdcStatusUpdate { .. }))
.await;
match event {
EventType::WebxdcStatusUpdate(msg_id) => {
EventType::WebxdcStatusUpdate {
msg_id,
status_update_serial: _,
} => {
assert_eq!(msg_id, instance_id);
}
_ => unreachable!(),