Skip to content

Commit

Permalink
address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mangas committed Mar 10, 2023
1 parent faf558d commit 3a768ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions graph/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions graph/src/firehose/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<FirehoseEndpoint>> {
let endpoint = self.0.iter().sorted_by_key(|x| x.current_error_count()).try_fold(None,|acc,adapter| {
match adapter.get_capacity() {
Expand Down

0 comments on commit 3a768ac

Please sign in to comment.