Skip to content

Commit

Permalink
ignore empty keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Feb 27, 2025
1 parent d806a64 commit ce53b91
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions crates/torii/grpc/src/server/subscriptions/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,13 @@ impl Service {
let hashed = Felt::from_str(&entity.id).map_err(ParseError::FromStr)?;
// keys is empty when an entity is updated with StoreUpdateRecord or Member but the entity
// has never been set before. In that case, we dont know the keys
let keys = if entity.keys.is_empty() {
vec![]
} else {
entity
.keys
.trim_end_matches(SQL_FELT_DELIMITER)
.split(SQL_FELT_DELIMITER)
.map(Felt::from_str)
.collect::<Result<Vec<_>, _>>()
.map_err(ParseError::FromStr)?
};
let keys = entity
.keys
.trim_end_matches(SQL_FELT_DELIMITER)
.split(SQL_FELT_DELIMITER)
.filter_map(|key| if key.is_empty() { None } else { Some(Felt::from_str(key)) })

Check warning on line 123 in crates/torii/grpc/src/server/subscriptions/entity.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/subscriptions/entity.rs#L123

Added line #L123 was not covered by tests
.collect::<Result<Vec<_>, _>>()
.map_err(ParseError::FromStr)?;

for (idx, sub) in subs.subscribers.read().await.iter() {
// Check if the subscriber is interested in this entity
Expand Down

0 comments on commit ce53b91

Please sign in to comment.