change to f64
This commit is contained in:
parent
e7a51c07d0
commit
ec44f3d568
2 changed files with 9 additions and 9 deletions
|
@ -9,7 +9,6 @@ use rusqlite::{params, Connection, DatabaseName::Main, OptionalExtension};
|
|||
use std::{
|
||||
collections::BTreeMap,
|
||||
future::Future,
|
||||
num::NonZeroU32,
|
||||
ops::Deref,
|
||||
path::{Path, PathBuf},
|
||||
pin::Pin,
|
||||
|
@ -246,10 +245,13 @@ impl Engine {
|
|||
}
|
||||
|
||||
// Reaps (at most) (.len() / `fraction`) (rounded down, min 1) connections.
|
||||
pub fn reap_spillover_by_fraction(&self, fraction: NonZeroU32) {
|
||||
pub fn reap_spillover_by_fraction(&self, fraction: f64) {
|
||||
let mut reaped = 0;
|
||||
|
||||
let amount = ((self.pool.spills.1.len() as u32) / fraction).max(1);
|
||||
let spill_amount = self.pool.spills.1.len() as f64;
|
||||
let fraction = fraction.max(1.0 /* Can never be too sure */);
|
||||
|
||||
let amount = (spill_amount / fraction).max(1.0) as u32;
|
||||
|
||||
for _ in 0..amount {
|
||||
if self.pool.spills.try_take().is_some() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue