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