Fix missing device_one_time_keys_count in empty timeout responses.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-09-10 21:29:04 +00:00
parent 54b347b855
commit 19dc5fafd4

View File

@@ -183,8 +183,9 @@ pub(crate) async fn sync_events_route(
// Wait for activity
if time::timeout_at(stop_at, watchers).await.is_err() || services.server.is_stopping() {
let response = build_empty_response(&services, &body, next_batch).await;
trace!(since, next_batch, "empty response");
return Ok(sync_events::v3::Response::new(next_batch.to_string()));
return Ok(response);
}
trace!(
@@ -199,6 +200,21 @@ pub(crate) async fn sync_events_route(
}
}
async fn build_empty_response(
services: &Services,
body: &Ruma<sync_events::v3::Request>,
next_batch: u64,
) -> sync_events::v3::Response {
sync_events::v3::Response {
device_one_time_keys_count: services
.users
.count_one_time_keys(body.sender_user(), body.sender_device())
.await,
..sync_events::v3::Response::new(next_batch.to_string())
}
}
#[tracing::instrument(
name = "build",
level = "debug",