From ef1f8112757b9308a874a646795b5ff2abba9110 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 21 Dec 2023 01:09:48 -0800 Subject: [PATCH] Fix task URI initial query --- nft_ingester/src/tasks/common/mod.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nft_ingester/src/tasks/common/mod.rs b/nft_ingester/src/tasks/common/mod.rs index 42e2d5230..c10fd9ee3 100644 --- a/nft_ingester/src/tasks/common/mod.rs +++ b/nft_ingester/src/tasks/common/mod.rs @@ -75,6 +75,11 @@ impl DownloadMetadataTask { } } +#[derive(FromQueryResult, Debug, Default, Clone, Eq, PartialEq)] +struct MetadataUrl { + pub metadata_url: String, +} + #[async_trait] impl BgTask for DownloadMetadataTask { fn name(&self) -> &'static str { @@ -107,12 +112,12 @@ impl BgTask for DownloadMetadataTask { _ => serde_json::Value::String("Invalid Uri".to_string()), //TODO -> enumize this. }; - match asset_data::Entity::find_by_id(download_metadata.asset_data_id.clone()) + let query = asset_data::Entity::find_by_id(download_metadata.asset_data_id.clone()) .select_only() .column(asset_data::Column::MetadataUrl) - .one(db) - .await? - { + .build(DbBackend::Postgres); + + match MetadataUrl::find_by_statement(query).one(db).await? { Some(asset) => { if asset.metadata_url != download_metadata.uri { debug!(