forked from lavina/lavina
1
0
Fork 0
This commit is contained in:
Nikita Vilunov 2024-05-10 15:22:51 +02:00
parent cb889193c7
commit 3e414f4038
3 changed files with 14 additions and 10 deletions

View File

@ -26,6 +26,7 @@ impl Broadcasting {
}
/// Broadcasts the given update to subscribed player actors on local node.
#[tracing::instrument(skip(self, players, message, created_at), name = "Broadcasting::broadcast")]
pub async fn broadcast(
&self,
players: &PlayerRegistry,

View File

@ -721,16 +721,18 @@ impl Player {
async fn get_rooms(&self) -> Vec<RoomInfo> {
let mut response = vec![];
for (room_id, handle) in &self.my_rooms {
if let RoomRef::Local(handle) = handle {
match handle {
RoomRef::Local(handle) => {
response.push(handle.get_room_info().await);
} else {
}
RoomRef::Remote { .. } => {
let room_info = RoomInfo {
id: room_id.clone(),
topic: "unknown".into(),
members: vec![],
};
response.push(room_info);
// TODO
}
}
}
response

View File

@ -50,6 +50,7 @@ impl Storage {
}
pub async fn create_or_retrieve_room_id_by_name(&self, name: &str) -> Result<u32> {
// TODO we don't need any info except the name on non-owning nodes, should remove stubs here
let mut executor = self.conn.lock().await;
let res: (u32,) = sqlx::query_as(
"insert into rooms(name, topic)