diff --git a/lib/ain-ocean/src/api/stats/cache.rs b/lib/ain-ocean/src/api/stats/cache.rs index de29ea27cf..cdc60a00b8 100644 --- a/lib/ain-ocean/src/api/stats/cache.rs +++ b/lib/ain-ocean/src/api/stats/cache.rs @@ -105,19 +105,15 @@ pub async fn get_count(ctx: &Arc) -> Result { .get_latest()? .map_or(0, |mn| mn.stats.count); - let mut set: HashSet<(Token, Currency)> = HashSet::new(); let prices = ctx .services .price_ticker .by_id .list(None, SortOrder::Descending)? - .flat_map(|item| { - let ((_, _, token, currency), _) = item?; - set.insert((token, currency)); - Ok::, Error>(set.clone()) + .filter_map(|item| { + item.ok().map(|((_, _, token, currency), _)| (token, currency)) }) - .next() - .unwrap_or(set); + .collect::>(); Ok(Count { blocks: 0,