mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
fix: adjust pool usage in tests and examples
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user