fix: adjust pool usage in tests and examples

This commit is contained in:
Ryan Leckey
2020-07-12 04:42:48 -07:00
parent 8cf3ccc7e9
commit fc682fa991
8 changed files with 36 additions and 35 deletions

View File

@@ -1,12 +1,12 @@
#[macro_use]
extern crate log;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use anyhow::Result;
use dotenv::dotenv;
use listenfd::ListenFd;
use std::env;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use sqlx::PgPool;
use anyhow::Result;
use std::env;
// import todo module (routes and model)
mod todo;
@@ -35,7 +35,7 @@ async fn main() -> Result<()> {
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL is not set in .env file");
// PgPool::builder()
// .max_size(5) // maximum number of connections in the pool
// .max_connections(5) // maximum number of connections in the pool
// .build(env::var("DATABASE_URL")?).await?;
let db_pool = PgPool::new(&database_url).await?;
@@ -62,4 +62,4 @@ async fn main() -> Result<()> {
}
// export DATABASE_URL="postgres://pguser:zx@192.168.33.11/realworld"
// systemfd --no-pid -s http::5000 -- cargo watch -x run
// systemfd --no-pid -s http::5000 -- cargo watch -x run