forked from lavina/lavina
wip
This commit is contained in:
parent
3e414f4038
commit
3b95f0cf9e
|
@ -629,9 +629,6 @@ impl Player {
|
|||
RoomRef::Local(room) => {
|
||||
room.unsubscribe(&self.player_id).await;
|
||||
room.remove_member(&self.player_id, self.storage_id).await;
|
||||
let room_storage_id =
|
||||
self.storage.create_or_retrieve_room_id_by_name(room_id.as_inner()).await.unwrap();
|
||||
self.storage.remove_room_member(room_storage_id, self.storage_id).await.unwrap();
|
||||
}
|
||||
RoomRef::Remote { node_id } => {
|
||||
let req = LeaveRoomReq {
|
||||
|
@ -639,6 +636,9 @@ impl Player {
|
|||
player_id: self.player_id.as_inner(),
|
||||
};
|
||||
self.cluster_client.leave_room(node_id, req).await.unwrap();
|
||||
let room_storage_id =
|
||||
self.storage.create_or_retrieve_room_id_by_name(room_id.as_inner()).await.unwrap();
|
||||
self.storage.remove_room_member(room_storage_id, self.storage_id).await.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ impl Storage {
|
|||
let res: (u32,) = sqlx::query_as(
|
||||
"insert into rooms(name, topic)
|
||||
values (?, '')
|
||||
on conflict(name) do nothing
|
||||
on conflict(name) do update set name = excluded.name
|
||||
returning id;",
|
||||
)
|
||||
.bind(name)
|
||||
|
|
|
@ -19,6 +19,7 @@ use tokio_rustls::rustls::{ClientConfig, ServerName};
|
|||
use tokio_rustls::TlsConnector;
|
||||
|
||||
use lavina_core::auth::Authenticator;
|
||||
use lavina_core::clustering::{ClusterConfig, ClusterMetadata};
|
||||
use lavina_core::repo::{Storage, StorageConfig};
|
||||
use lavina_core::LavinaCore;
|
||||
use projection_xmpp::{launch, RunningServer, ServerConfig};
|
||||
|
@ -161,7 +162,16 @@ impl TestServer {
|
|||
db_path: ":memory:".into(),
|
||||
})
|
||||
.await?;
|
||||
let core = LavinaCore::new(metrics.clone(), storage.clone()).await?;
|
||||
let cluster_config = ClusterConfig {
|
||||
addresses: vec![],
|
||||
metadata: ClusterMetadata {
|
||||
node_id: 0,
|
||||
main_owner: 0,
|
||||
test_owner: 0,
|
||||
test2_owner: 0,
|
||||
},
|
||||
};
|
||||
let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?;
|
||||
let server = launch(config, core.clone(), metrics.clone()).await.unwrap();
|
||||
Ok(TestServer {
|
||||
metrics,
|
||||
|
|
Loading…
Reference in New Issue