mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-19 10:13:08 +00:00
Run cargo fmt.
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
use async_trait::async_trait;
|
||||
use priority_queue::PriorityQueue;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use priority_queue::PriorityQueue;
|
||||
use tokio::{
|
||||
sync::{Mutex, OwnedSemaphorePermit, Semaphore},
|
||||
};
|
||||
use tokio::sync::{Mutex, OwnedSemaphorePermit, Semaphore};
|
||||
use uuid;
|
||||
use async_trait::async_trait;
|
||||
|
||||
|
||||
#[async_trait]
|
||||
pub trait PooledClientFactory<T>: Send + Sync + 'static {
|
||||
/// Create a new pooled item.
|
||||
async fn create(&self, connect_timeout: Duration) -> Result<Result<T, tonic::Status>, tokio::time::error::Elapsed>;
|
||||
async fn create(
|
||||
&self,
|
||||
connect_timeout: Duration,
|
||||
) -> Result<Result<T, tonic::Status>, tokio::time::error::Elapsed>;
|
||||
}
|
||||
|
||||
|
||||
/// A pooled gRPC client with capacity tracking and error handling.
|
||||
pub struct ClientCache<T> {
|
||||
inner: Mutex<Inner<T>>,
|
||||
@@ -57,7 +56,6 @@ struct CacheEntry<T> {
|
||||
last_used: Instant,
|
||||
}
|
||||
|
||||
|
||||
/// A client borrowed from the pool.
|
||||
pub struct PooledClient<T> {
|
||||
pub client: T,
|
||||
@@ -103,6 +101,3 @@ impl<T: Clone + Send + 'static> PooledClient<T> {
|
||||
return self.client.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user