Skip to main content

tuwunel_admin/query/sync/
drop_connections.rs

1use ruma::{OwnedDeviceId, OwnedUserId};
2use tuwunel_core::Result;
3
4use crate::admin_command;
5
6#[admin_command]
7pub(super) async fn drop_connections(
8	&self,
9	user_id: Option<OwnedUserId>,
10	device_id: Option<OwnedDeviceId>,
11	conn_id: Option<String>,
12) -> Result {
13	let dropped = self
14		.services
15		.sync
16		.clear_connections(
17			user_id.as_deref(),
18			device_id.as_deref(),
19			conn_id.map(Into::into).as_ref(),
20		)
21		.await;
22
23	write!(self, "Dropped {dropped} connections.").await
24}