From 512fea9aaabcda2bd5d119f1a1f7a5c8d7c25fc6 Mon Sep 17 00:00:00 2001 From: Kyle Espinola Date: Wed, 18 Oct 2023 19:39:23 +0200 Subject: [PATCH] test: add logs to help debug redis lookup errors --- api/src/dataloaders/collection.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/src/dataloaders/collection.rs b/api/src/dataloaders/collection.rs index b129d54..4907a18 100644 --- a/api/src/dataloaders/collection.rs +++ b/api/src/dataloaders/collection.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use async_graphql::{dataloader::Loader as DataLoader, FieldError, Result}; +use hub_core::tracing::info; use poem::async_trait; use redis::{AsyncCommands, Client as Redis}; use sea_orm::{prelude::*, FromQueryResult, QueryFilter, QuerySelect}; @@ -76,8 +77,13 @@ impl DataLoader for TotalMintsLoader { for key in keys { let redis_key = format!("collection:{key}:total_mints"); + info!("total mints loader - get: redis_key: {}", redis_key); match redis_connection.get::<_, i64>(&redis_key).await { Ok(value) => { + info!( + "total mints loader - get: redis_key: {} value: {:?}", + redis_key, value + ); results.insert(*key, value); }, Err(_) => { @@ -113,6 +119,11 @@ impl DataLoader for TotalMintsLoader { let count = count_results.get(&key).copied().unwrap_or_default(); let redis_key = format!("collection:{key}:total_mints"); + info!( + "total mints loader - insert: redis_key: {} count: {:?}", + redis_key, count + ); + redis_connection .set::<_, i64, Option>(&redis_key, count) .await?; @@ -156,8 +167,13 @@ impl DataLoader for SupplyLoader { for key in keys { let redis_key = format!("collection:{key}:supply"); + info!("supply loader - get: redis_key: {}", redis_key); match redis_connection.get::<_, Option>(&redis_key).await { Ok(value) => { + info!( + "supply loader - get: redis_key: {} value: {:?}", + redis_key, value + ); results.insert(*key, value); }, Err(_) => { @@ -217,6 +233,10 @@ impl DataLoader for SupplyLoader { for key in computed_supplies { let count = count_results.get(&key).copied(); let redis_key = format!("collection:{key}:supply"); + info!( + "supply loader - insert: redis_key: {} count: {:?}", + redis_key, count + ); redis_connection .set::<_, Option, Option>(&redis_key, count)