mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 12:16:54 +00:00
fix: Store to-device messages before syncs can read their count
This commit is contained in:
1 parent
fb389cb6f9
commit
8c720e5427
2 files changed
+14
-11
No files matched your search
@@ -0,0 +1 @@
|
||||
Fix to-device messages, including room keys, sometimes being lost before delivery. Contributed by @eleboucher.
|
||||
+13
-11
@@ -216,17 +216,19 @@ impl super::Service {
|
||||
event_type: &str,
|
||||
content: serde_json::Value,
|
||||
) {
|
||||
let count = self.services.globals.next_count().unwrap();
|
||||
|
||||
let key = (target_user_id, target_device_id, count);
|
||||
self.db.todeviceid_events.put(
|
||||
key,
|
||||
Json(json!({
|
||||
"type": event_type,
|
||||
"sender": sender,
|
||||
"content": content,
|
||||
})),
|
||||
);
|
||||
let event = Json(json!({
|
||||
"type": event_type,
|
||||
"sender": sender,
|
||||
"content": content,
|
||||
}));
|
||||
self.services
|
||||
.globals
|
||||
.next_count_with(|count| {
|
||||
self.db
|
||||
.todeviceid_events
|
||||
.put((target_user_id, target_device_id, count), event);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
self.services.sync.wake(target_user_id).await;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user