Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Sep 19, 2024
1 parent 51d507b commit f795c3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 34 deletions.
6 changes: 2 additions & 4 deletions crates/torii/core/src/query_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ impl QueryQueue {
.fetch_one(&mut *tx)
.await?;
let mut entity_updated = EntityUpdated::from_row(&row)?;
entity_updated.updated_model = Some(Ty::Struct(Struct {
name: entity.ty.name(),
children: vec![],
}));
entity_updated.updated_model =
Some(Ty::Struct(Struct { name: entity.ty.name(), children: vec![] }));

let count = sqlx::query_scalar::<_, i64>(
"SELECT count(*) FROM entity_model WHERE entity_id = ?",
Expand Down
10 changes: 4 additions & 6 deletions crates/torii/grpc/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ impl DojoWorld {
Arc::clone(&state_diff_manager),
));

tokio::task::spawn(subscriptions::entity::Service::new(
Arc::clone(&entity_manager),
));
tokio::task::spawn(subscriptions::entity::Service::new(Arc::clone(&entity_manager)));

tokio::task::spawn(subscriptions::event_message::Service::new(
Arc::clone(&event_message_manager),
));
tokio::task::spawn(subscriptions::event_message::Service::new(Arc::clone(
&event_message_manager,
)));

tokio::task::spawn(subscriptions::event::Service::new(Arc::clone(&event_manager)));

Expand Down
18 changes: 4 additions & 14 deletions crates/torii/grpc/src/server/subscriptions/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,11 @@ pub struct Service {
}

impl Service {
pub fn new(
subs_manager: Arc<EntityManager>,
) -> Self {
Self {
subs_manager,
simple_broker: Box::pin(SimpleBroker::<Entity>::subscribe()),
}
pub fn new(subs_manager: Arc<EntityManager>) -> Self {
Self { subs_manager, simple_broker: Box::pin(SimpleBroker::<Entity>::subscribe()) }
}

async fn publish_updates(
subs: Arc<EntityManager>,
entity: &Entity,
) -> Result<(), Error> {
async fn publish_updates(subs: Arc<EntityManager>, entity: &Entity) -> Result<(), Error> {
let mut closed_stream = Vec::new();
let hashed = Felt::from_str(&entity.id).map_err(ParseError::FromStr)?;
let keys = entity
Expand Down Expand Up @@ -196,9 +188,7 @@ impl Service {
let resp = proto::world::SubscribeEntityResponse {
entity: Some(proto::types::Entity {
hashed_keys: hashed.to_bytes_be().to_vec(),
models: vec![
model.into()
],
models: vec![model.into()],
}),
subscription_id: *idx,
};
Expand Down
13 changes: 3 additions & 10 deletions crates/torii/grpc/src/server/subscriptions/event_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ pub struct Service {
}

impl Service {
pub fn new(
subs_manager: Arc<EventMessageManager>,
) -> Self {
Self {
subs_manager,
simple_broker: Box::pin(SimpleBroker::<EventMessage>::subscribe()),
}
pub fn new(subs_manager: Arc<EventMessageManager>) -> Self {
Self { subs_manager, simple_broker: Box::pin(SimpleBroker::<EventMessage>::subscribe()) }
}

async fn publish_updates(
Expand Down Expand Up @@ -174,9 +169,7 @@ impl Service {
let resp = proto::world::SubscribeEntityResponse {
entity: Some(proto::types::Entity {
hashed_keys: hashed.to_bytes_be().to_vec(),
models: vec![
model.into()
],
models: vec![model.into()],
}),
subscription_id: *idx,
};
Expand Down

0 comments on commit f795c3a

Please sign in to comment.