diff --git a/src/controller/tigergraphql/hold.rs b/src/controller/tigergraphql/hold.rs index e6e10ed8..d5301073 100644 --- a/src/controller/tigergraphql/hold.rs +++ b/src/controller/tigergraphql/hold.rs @@ -1,7 +1,6 @@ use crate::{ error::{Error, Result}, tigergraph::{ - delete_vertex_and_edge, edge::{Hold, HoldRecord}, vertex::{ContractLoadFn, ContractRecord, IdentityLoadFn, IdentityRecord}, }, @@ -12,7 +11,6 @@ use crate::{ use async_graphql::{Context, Object}; use dataloader::non_cached::Loader; use strum::IntoEnumIterator; -use tokio::time::{sleep, Duration}; use uuid::Uuid; #[Object] @@ -177,15 +175,10 @@ impl HoldQuery { let target = Target::NFT(chain, category, contract_address.clone(), id.clone()); match Hold::find_by_id_chain_address(&client, &id, &chain, &contract_address).await? { Some(hold) => { - let v_id = hold.from_id.clone(); + // let v_id = hold.from_id.clone(); if hold.is_outdated() { - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target], Some(3)).await?; - Ok::<_, Error>(()) - }); + // Refetch in the background + tokio::spawn(fetch_all(vec![target], Some(3))); } Ok(Some(hold)) } diff --git a/src/controller/tigergraphql/identity.rs b/src/controller/tigergraphql/identity.rs index 83ac202b..1208fe28 100644 --- a/src/controller/tigergraphql/identity.rs +++ b/src/controller/tigergraphql/identity.rs @@ -1,7 +1,6 @@ use crate::{ error::{Error, Result}, tigergraph::{ - delete_vertex_and_edge, edge::{resolve::ResolveReverse, EdgeUnion, HoldRecord}, vertex::{ Identity, IdentityRecord, IdentityWithSource, NeighborReverseLoadFn, OwnerLoadFn, @@ -14,7 +13,6 @@ use crate::{ use async_graphql::{Context, Object}; use dataloader::non_cached::Loader; use strum::IntoEnumIterator; -use tokio::time::{sleep, Duration}; use tracing::{event, Level}; use uuid::Uuid; @@ -297,14 +295,9 @@ impl IdentityQuery { identity, "Outdated. Delete and Refetching." ); - let v_id = found.v_id.clone(); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target], Some(3)).await?; - Ok::<_, Error>(()) - }); + // let v_id = found.v_id.clone(); + // Refetch in the background + tokio::spawn(fetch_all(vec![target], Some(3))); } Ok(Some(found)) } diff --git a/src/controller/tigergraphql/relation.rs b/src/controller/tigergraphql/relation.rs index 75f0a8d7..3eb662bd 100644 --- a/src/controller/tigergraphql/relation.rs +++ b/src/controller/tigergraphql/relation.rs @@ -1,9 +1,8 @@ use std::vec; use crate::{ - error::{Error, Result}, + error::Result, tigergraph::{ - delete_vertex_and_edge, edge::{RelationUniqueTX, RelationUniqueTXRecord}, vertex::{Identity, IdentityRecord}, }, @@ -11,7 +10,6 @@ use crate::{ util::make_http_client, }; use async_graphql::{Context, Object}; -use tokio::time::{sleep, Duration}; use tracing::{event, Level}; #[Object] @@ -89,14 +87,9 @@ impl RelationQuery { source_identity, "Outdated. Delete and Refetching." ); - let v_id = found.v_id.clone(); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![source_fetch], Some(3)).await?; - Ok::<_, Error>(()) - }); + // let v_id = found.v_id.clone(); + // Refetch in the background + tokio::spawn(fetch_all(vec![source_fetch], Some(3))); } Some(found) } @@ -129,14 +122,8 @@ impl RelationQuery { target_identity, "Outdated. Delete and Refetching." ); - let v_id = found.v_id.clone(); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target_fetch], Some(3)).await?; - Ok::<_, Error>(()) - }); + // let v_id = found.v_id.clone(); + tokio::spawn(fetch_all(vec![target_fetch], Some(3))); } Some(found) } @@ -189,14 +176,9 @@ impl RelationQuery { identity, "Outdated. Delete and Refetching." ); - let v_id = found.v_id.clone(); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target], Some(3)).await?; - Ok::<_, Error>(()) - }); + // let v_id = found.v_id.clone(); + // Refetch in the background + tokio::spawn(fetch_all(vec![target], Some(3))); } Some(found) } diff --git a/src/controller/tigergraphql/resolve.rs b/src/controller/tigergraphql/resolve.rs index 3456bd11..342ef801 100644 --- a/src/controller/tigergraphql/resolve.rs +++ b/src/controller/tigergraphql/resolve.rs @@ -1,7 +1,6 @@ use crate::{ error::{Error, Result}, tigergraph::{ - delete_vertex_and_edge, edge::{resolve::ResolveReverse, Resolve, ResolveEdge}, vertex::IdentityRecord, }, @@ -12,7 +11,6 @@ use crate::{ }; use async_graphql::{Context, Object}; use strum::IntoEnumIterator; -use tokio::time::{sleep, Duration}; use uuid::Uuid; #[Object] @@ -153,18 +151,13 @@ impl ResolveQuery { } Some(resolve) => { if resolve.is_outdated() { - let v_id: String = resolve + let _vid: String = resolve .clone() .owner .and_then(|f| Some(f.v_id.clone())) .unwrap_or("".to_string()); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target], Some(3)).await?; - Ok::<_, Error>(()) - }); + // Refetch in the background + tokio::spawn(fetch_all(vec![target], Some(3))); } Ok(Some(resolve)) } @@ -183,18 +176,13 @@ impl ResolveQuery { } Some(resolve) => { if resolve.is_outdated() { - let v_id: String = resolve + let _vid: String = resolve .clone() .owner .and_then(|f| Some(f.v_id.clone())) .unwrap_or("".to_string()); - tokio::spawn(async move { - // Delete and Refetch in the background - sleep(Duration::from_secs(10)).await; - delete_vertex_and_edge(&client, v_id).await?; - fetch_all(vec![target], Some(3)).await?; - Ok::<_, Error>(()) - }); + // Refetch in the background + tokio::spawn(fetch_all(vec![target], Some(3))); } Ok(Some(resolve)) } diff --git a/src/tigergraph/mod.rs b/src/tigergraph/mod.rs index b336bab2..6434e904 100644 --- a/src/tigergraph/mod.rs +++ b/src/tigergraph/mod.rs @@ -110,6 +110,7 @@ impl Graph { } } +#[allow(dead_code)] pub async fn delete_vertex_and_edge( client: &Client, v_id: String,