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

@@ -15,7 +15,7 @@ This Cargo project implements various benchmarks for SQLx using
the pool, with or without the pool being fair. Concurrently to the benchmark iteration
function calling and blocking on `Pool::acquire()`, a varying number of background tasks are
also calling `acquire()` and holding the acquired connection for 500µs each before releasing
it back to the pool. The pool is created with `.min_size(50).max_size(50)` so we shouldn't
it back to the pool. The pool is created with `.min_connections(50).max_connections(50)` so we shouldn't
be measuring anything but the actual overhead of `Pool`'s bookeeping.
### Running

View File

@@ -27,11 +27,11 @@ fn do_bench_acquire(b: &mut Bencher, concurrent: u32, fair: bool) {
// we don't want timeouts because we want to see how the pool degrades
.connect_timeout(Duration::from_secs(3600))
// force the pool to start full
.min_size(50)
.max_size(50)
.min_connections(50)
.max_connections(50)
// we're not benchmarking `ping()`
.test_on_acquire(false)
.fair(fair)
.test_before_acquire(false)
.__fair(fair)
.build(
&dotenv::var("DATABASE_URL").expect("DATABASE_URL must be set to run benchmarks"),
),