update to support user expire, timeout, and disconnect

This commit is contained in:
Evan Carroll 2026-01-17 23:47:02 -06:00
parent fe65835f4a
commit 5fcd49e847
16 changed files with 744 additions and 238 deletions

View file

@ -273,3 +273,27 @@ pub async fn set_afk<'e>(
Ok(())
}
/// Update the last_moved_at timestamp to keep the member alive.
///
/// Called when a ping is received from the client to prevent
/// the member from being reaped by the stale member cleanup.
pub async fn touch_member<'e>(
executor: impl PgExecutor<'e>,
channel_id: Uuid,
user_id: Uuid,
) -> Result<(), AppError> {
sqlx::query(
r#"
UPDATE scene.instance_members
SET last_moved_at = now()
WHERE instance_id = $1 AND user_id = $2
"#,
)
.bind(channel_id)
.bind(user_id)
.execute(executor)
.await?;
Ok(())
}