feat: database reader connection pooling

Added connection pooling for queries, as well as basic configuration
options for min/max connections.
This commit is contained in:
Greg Heartsfield
2022-01-25 20:39:24 -06:00
parent af453548ee
commit f1206e76f2
6 changed files with 95 additions and 15 deletions
Generated
+32
View File
@@ -662,6 +662,8 @@ dependencies = [
"lazy_static",
"log",
"nonzero_ext",
"r2d2",
"r2d2_sqlite",
"rusqlite",
"secp256k1",
"serde 1.0.131",
@@ -811,6 +813,27 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "r2d2"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f"
dependencies = [
"log",
"parking_lot",
"scheduled-thread-pool",
]
[[package]]
name = "r2d2_sqlite"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54ca3c9468a76fc2ad724c486a59682fc362efeac7b18d1c012958bc19f34800"
dependencies = [
"r2d2",
"rusqlite",
]
[[package]]
name = "rand"
version = "0.6.5"
@@ -1028,6 +1051,15 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "254df5081ce98661a883445175e52efe99d1cb2a5552891d965d2f5d0cad1c16"
[[package]]
name = "scheduled-thread-pool"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7"
dependencies = [
"parking_lot",
]
[[package]]
name = "scopeguard"
version = "1.1.0"