From 25f6b219901dd212e4f677cddcccc2e60be18ee2 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 13 May 2026 16:54:44 -0500 Subject: [PATCH] Schedule `SyncDevicesJob` after `dangerous_hard_limit_eviction` --- crates/handlers/src/compat/login.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/handlers/src/compat/login.rs b/crates/handlers/src/compat/login.rs index 7b13c6552..854b82279 100644 --- a/crates/handlers/src/compat/login.rs +++ b/crates/handlers/src/compat/login.rs @@ -508,6 +508,7 @@ pub(crate) async fn post( /// Given the violations from [`Policy::evaluate_compat_login`], return the /// appropriate `RouteError` response. async fn process_violations_for_compat_login( + rng: &mut (dyn RngCore + Send), clock: &dyn Clock, repo: &mut BoxRepository, session_limit_config: Option<&SessionLimitConfig>, @@ -602,6 +603,11 @@ async fn process_violations_for_compat_login( .finish(clock, compat_session.to_owned()) .await?; } + + // Schedule a device sync with the homeserver + repo.queue_job() + .schedule_job(rng, clock, SyncDevicesJob::new_for_id(user.id)) + .await?; } else { // Tell the user about the limit return Err(RouteError::PolicyHardSessionLimitReached); @@ -846,6 +852,7 @@ async fn token_login( }) .await?; process_violations_for_compat_login( + rng, clock, repo, session_limit_config, @@ -972,8 +979,15 @@ async fn user_password_login( requester: policy_requester, }) .await?; - process_violations_for_compat_login(clock, repo, session_limit_config, &user, res.violations) - .await?; + process_violations_for_compat_login( + rng, + clock, + repo, + session_limit_config, + &user, + res.violations, + ) + .await?; let session = repo .compat_session()