Skip to content

Commit

Permalink
chore: update log to include member nname
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Jul 17, 2024
1 parent 8aba41c commit 65b2c39
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions crates/torii/core/src/processors/store_update_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,26 @@ where
let member_selector = event.data[MEMBER_INDEX];

let model = db.model(selector).await?;
let schema = model.schema().await?;
let mut ty = schema
.as_struct()
.expect("model schema must be a struct")
.children
.iter()
.find(|c| {
get_selector_from_name(&c.name).expect("invalid selector for member name")
== member_selector
})
.context("member not found")?
.ty
.clone();

info!(
target: LOG_TARGET,
name = %model.name(),
entity_id = format!("{:#x}", entity_id),
"Store update record.",
member = %ty.name(),
"Store update member.",
);

let values_start = MEMBER_INDEX + 1;
Expand All @@ -79,21 +93,8 @@ where
let keys = db.get_entity_keys(entity_id, &tag).await?;
let mut keys_and_unpacked = [keys, values].concat();

let schema = model.schema().await?;
let mut ty = schema
.as_struct()
.expect("model schema must be a struct")
.children
.iter()
.find(|c| {
get_selector_from_name(&c.name).expect("invalid selector for member name")
== member_selector
})
.context("member not found")?
.ty
.clone();

ty.deserialize(&mut keys_and_unpacked)?;

db.set_model_member(entity_id, &schema.name(), &ty, block_timestamp).await
}

Check warning on line 99 in crates/torii/core/src/processors/store_update_member.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/core/src/processors/store_update_member.rs#L54-L99

Added lines #L54 - L99 were not covered by tests
}

0 comments on commit 65b2c39

Please sign in to comment.