Add presence ping to sliding-sync.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-10-04 08:50:21 +00:00
parent 227b77e58e
commit 4baa25f66f
3 changed files with 22 additions and 15 deletions

20
Cargo.lock generated
View File

@@ -3509,7 +3509,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.13.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"assign",
"js_int",
@@ -3528,7 +3528,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.13.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"js_int",
"ruma-common",
@@ -3540,7 +3540,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.21.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"as_variant",
"assign",
@@ -3563,7 +3563,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.16.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"as_variant",
"base64",
@@ -3596,7 +3596,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.31.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"as_variant",
"indexmap",
@@ -3622,7 +3622,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.12.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"bytes",
"headers",
@@ -3644,7 +3644,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.11.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"js_int",
"thiserror 2.0.16",
@@ -3653,7 +3653,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.16.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"cfg-if",
"proc-macro-crate",
@@ -3668,7 +3668,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.12.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"js_int",
"ruma-common",
@@ -3680,7 +3680,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.18.0"
source = "git+https://github.com/matrix-construct/ruma?rev=b245c8cb8ab07ebbf7bc250b40385334c3fbf146#b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
source = "git+https://github.com/matrix-construct/ruma?rev=07fee6a5db8c1523399a2463fd8a1c50a04da759#07fee6a5db8c1523399a2463fd8a1c50a04da759"
dependencies = [
"base64",
"ed25519-dalek",

View File

@@ -320,7 +320,7 @@ default-features = false
[workspace.dependencies.ruma]
git = "https://github.com/matrix-construct/ruma"
rev = "b245c8cb8ab07ebbf7bc250b40385334c3fbf146"
rev = "07fee6a5db8c1523399a2463fd8a1c50a04da759"
features = [
"__compat",
"appservice-api-c",
@@ -353,7 +353,6 @@ features = [
"unstable-msc4310",
"unstable-msc4311",
"unstable-extensible-events",
"unstable-hydra",
]
[workspace.dependencies.rustls]

View File

@@ -31,7 +31,9 @@ use ruma::{
};
use tokio::time::{Instant, timeout_at};
use tuwunel_core::{
Err, Result, apply, at, debug_error, error, extract_variant, is_equal_to,
Err, Result, apply, at, debug_error, error,
error::inspect_log,
extract_variant, is_equal_to,
matrix::{Event, StateKey, TypeStateKey, pdu::PduCount},
pair_of, ref_at, trace,
utils::{
@@ -112,6 +114,12 @@ pub(crate) async fn sync_events_v5_route(
.sync
.update_snake_sync_request_with_cache(&snake_key, &mut request);
let ping_presence = services
.presence
.maybe_ping_presence(sender_user, &request.set_presence)
.inspect_err(inspect_log)
.ok();
let all_joined_rooms = services
.state_cache
.rooms_joined(sender_user)
@@ -130,8 +138,8 @@ pub(crate) async fn sync_events_v5_route(
.map(ToOwned::to_owned)
.collect::<Vec<OwnedRoomId>>();
let (all_joined_rooms, all_invited_rooms, all_knocked_rooms) =
join3(all_joined_rooms, all_invited_rooms, all_knocked_rooms).await;
let (all_joined_rooms, all_invited_rooms, all_knocked_rooms, _) =
join4(all_joined_rooms, all_invited_rooms, all_knocked_rooms, ping_presence).await;
let all_invited_rooms = all_invited_rooms.iter().map(AsRef::as_ref);
let all_knocked_rooms = all_knocked_rooms.iter().map(AsRef::as_ref);