Skip to content

Commit ca4bc01

Browse files
committed
add more documentation for limits on sqlite connection pool
1 parent 67741c6 commit ca4bc01

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Cargo.lock

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/storage/sqlite_pool.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ static MAX_LIFE_TIME: Duration = Duration::from_secs(60 * 60);
2727
///
2828
/// We keep at minimum of one connection per database, for one hour.
2929
/// Any additional connections will be dropped after 10 minutes of inactivity.
30+
///
31+
/// * `max_databases` is the maximum amout of databases in the pool.
32+
/// * for each of the databases, we manage a pool of 1-10 connections
3033
#[derive(Clone)]
3134
pub(crate) struct SqliteConnectionPool {
3235
pools: Cache<PathBuf, r2d2::Pool<SqliteConnectionManager>>,
@@ -39,10 +42,10 @@ impl Default for SqliteConnectionPool {
3942
}
4043

4144
impl SqliteConnectionPool {
42-
pub(crate) fn new(max_connections: NonZeroU64) -> Self {
45+
pub(crate) fn new(max_databases: NonZeroU64) -> Self {
4346
Self {
4447
pools: Cache::builder()
45-
.max_capacity(max_connections.get())
48+
.max_capacity(max_databases.get())
4649
.time_to_idle(MAX_LIFE_TIME)
4750
.build(),
4851
}

0 commit comments

Comments
 (0)