Skip to content

Commit

Permalink
f kill dev comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pjenvey committed Aug 22, 2020
1 parent 077bf09 commit a9da154
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/db/spanner/manager/bb8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::{
settings::Settings,
};

// XXX:
pub const SPANNER_ADDRESS: &str = "spanner.googleapis.com:443";

pub struct SpannerConnectionManager<T> {
Expand Down Expand Up @@ -132,7 +131,6 @@ impl<T: std::marker::Send + std::marker::Sync + 'static> ManageConnection
}
}

// XXX:
pub async fn create_session(
client: &SpannerClient,
database_name: &str,
Expand Down
4 changes: 0 additions & 4 deletions src/db/spanner/manager/deadpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ use crate::{
settings::Settings,
};

// XXX:
use super::bb8::{create_session, SpannerSession, SPANNER_ADDRESS};

// - -> SpannerSessionManager (and bb8 too)
// - bb8s doesn't need the PhantomData
// - kill the lifetimes for now or PhantomData one
pub struct Manager {
database_name: String,
/// The gRPC environment
Expand Down
10 changes: 0 additions & 10 deletions src/db/spanner/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use super::manager::bb8::SpannerSession;
use super::models::SpannerDb;
use crate::error::ApiResult;

//pub(super) type Conn<'a> = PooledConnection<'a, SpannerConnectionManager<SpannerSession>>;
pub(super) type Conn = deadpool::managed::Object<SpannerSession, DbError>;

embed_migrations!();
Expand Down Expand Up @@ -49,14 +48,7 @@ impl SpannerDbPool {
}

pub async fn new_without_migrations(settings: &Settings, metrics: &Metrics) -> Result<Self> {
//let manager = SpannerConnectionManager::<SpannerSession>::new(settings, metrics)?;
let max_size = settings.database_pool_max_size.unwrap_or(10);
/*
let builder = bb8::Pool::builder()
.max_size(max_size)
.min_idle(settings.database_pool_min_idle)
.error_sink(Box::new(LoggingErrorSink));
*/
let manager = super::manager::deadpool::Manager::new(settings, metrics)?;
let config = deadpool::managed::PoolConfig::new(max_size as usize);
let pool = deadpool::managed::Pool::from_config(manager, config);
Expand All @@ -70,8 +62,6 @@ impl SpannerDbPool {

pub async fn get_async(&self) -> Result<SpannerDb> {
let conn = self.pool.get().await.map_err(|e| match e {
//bb8::RunError::User(dbe) => dbe,
//bb8::RunError::TimedOut => DbError::internal("bb8:TimedOut"),
deadpool::managed::PoolError::Backend(dbe) => dbe,
deadpool::managed::PoolError::Timeout(timeout_type) => {
DbError::internal(&format!("deadpool Timeout: {:?}", timeout_type))
Expand Down

0 comments on commit a9da154

Please sign in to comment.