From 3a768ac7f9b5278ca51cf3c60e2b08be379be536 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Fri, 10 Mar 2023 16:45:28 +0000 Subject: [PATCH] address code review comments --- graph/src/endpoint.rs | 5 +---- graph/src/firehose/endpoints.rs | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/graph/src/endpoint.rs b/graph/src/endpoint.rs index a127ac0b4fc..bb67c5f0643 100644 --- a/graph/src/endpoint.rs +++ b/graph/src/endpoint.rs @@ -36,10 +36,7 @@ impl EndpointMetrics { .map(|h| (Host::from(h.as_ref()), AtomicU64::new(0))), )); - Self { - logger: logger.clone(), - hosts: hosts.clone(), - } + Self { logger, hosts } } /// This should only be used for testing. diff --git a/graph/src/firehose/endpoints.rs b/graph/src/firehose/endpoints.rs index 6ebf252ed23..1510b0577c4 100644 --- a/graph/src/firehose/endpoints.rs +++ b/graph/src/firehose/endpoints.rs @@ -412,10 +412,9 @@ impl FirehoseEndpoints { self.0.len() } - /// This function will attempt to grab an endpoint based on the following priority: - /// 1. Lowest error count with high capacity available. - /// 2. Lowest error count that has any capacity - /// If an adapter cannot be found `endpoint` will return an error. + /// This function will attempt to grab an endpoint based on the Lowest error count + // with high capacity available. If an adapter cannot be found `endpoint` will + // return an error. pub fn endpoint(&self) -> anyhow::Result> { let endpoint = self.0.iter().sorted_by_key(|x| x.current_error_count()).try_fold(None,|acc,adapter| { match adapter.get_capacity() {