forked from lavina/lavina
wip
This commit is contained in:
parent
cb889193c7
commit
3e414f4038
|
@ -26,6 +26,7 @@ impl Broadcasting {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Broadcasts the given update to subscribed player actors on local node.
|
/// 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(
|
pub async fn broadcast(
|
||||||
&self,
|
&self,
|
||||||
players: &PlayerRegistry,
|
players: &PlayerRegistry,
|
||||||
|
|
|
@ -721,16 +721,18 @@ impl Player {
|
||||||
async fn get_rooms(&self) -> Vec<RoomInfo> {
|
async fn get_rooms(&self) -> Vec<RoomInfo> {
|
||||||
let mut response = vec![];
|
let mut response = vec![];
|
||||||
for (room_id, handle) in &self.my_rooms {
|
for (room_id, handle) in &self.my_rooms {
|
||||||
if let RoomRef::Local(handle) = handle {
|
match handle {
|
||||||
response.push(handle.get_room_info().await);
|
RoomRef::Local(handle) => {
|
||||||
} else {
|
response.push(handle.get_room_info().await);
|
||||||
let room_info = RoomInfo {
|
}
|
||||||
id: room_id.clone(),
|
RoomRef::Remote { .. } => {
|
||||||
topic: "unknown".into(),
|
let room_info = RoomInfo {
|
||||||
members: vec![],
|
id: room_id.clone(),
|
||||||
};
|
topic: "unknown".into(),
|
||||||
response.push(room_info);
|
members: vec![],
|
||||||
// TODO
|
};
|
||||||
|
response.push(room_info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
|
|
|
@ -50,6 +50,7 @@ impl Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_or_retrieve_room_id_by_name(&self, name: &str) -> Result<u32> {
|
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 mut executor = self.conn.lock().await;
|
||||||
let res: (u32,) = sqlx::query_as(
|
let res: (u32,) = sqlx::query_as(
|
||||||
"insert into rooms(name, topic)
|
"insert into rooms(name, topic)
|
||||||
|
|
Loading…
Reference in New Issue