Skip to content

Commit

Permalink
execute queue when new token is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-0x committed Oct 2, 2024
1 parent 03f94d8 commit dd49dfc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/torii/core/src/sql/erc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl Sql {

if !token_exists {
self.register_erc20_token_metadata(contract_address, &token_id, provider).await?;
self.query_queue.execute_all().await?;
}

self.store_erc_transfer_event(
Expand Down Expand Up @@ -82,6 +83,7 @@ impl Sql {

if !token_exists {
self.register_erc721_token_metadata(contract_address, &token_id, provider).await?;
self.query_queue.execute_all().await?;
}

self.store_erc_transfer_event(
Expand Down Expand Up @@ -329,9 +331,6 @@ impl Sql {
}

pub async fn apply_cache_diff(&mut self) -> Result<()> {
// execute the query queue to apply any queries registering token metadata
self.query_queue.execute_all().await?;

for ((contract_type, id_str), balance) in self.local_cache.erc_cache.iter() {
let id = id_str.split(FELT_DELIMITER).collect::<Vec<&str>>();
match contract_type {
Expand Down

0 comments on commit dd49dfc

Please sign in to comment.