Skip to content

Commit 09f405f

Browse files
committed
increase default pool size for sqlite inmemory dbs
Fixes #713
1 parent 81a963e commit 09f405f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# The documentation site is fully static, so we don't need to persist any data.
2-
database_url: "sqlite::memory:"
2+
database_url: "sqlite::memory:?cache=shared"
33

44
# We have a file upload example, and would like to limit the size of the uploaded files
5-
max_uploaded_file_size: 256000
5+
max_uploaded_file_size: 256000
6+
7+
database_connection_acquire_timeout_seconds: 30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"database_url": "sqlite://:memory:",
3-
"database_connection_acquire_timeout_seconds": 86400
2+
"database_url": "sqlite://:memory:"
43
}

src/app_config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn parse_socket_addr(host_str: &str) -> anyhow::Result<SocketAddr> {
393393

394394
#[cfg(test)]
395395
fn default_database_url() -> String {
396-
"sqlite://:memory:".to_owned()
396+
"sqlite://:memory:?cache=shared".to_owned()
397397
}
398398
#[cfg(not(test))]
399399
fn default_database_url() -> String {
@@ -433,7 +433,7 @@ fn create_default_database(configuration_directory: &Path) -> String {
433433
}
434434

435435
log::warn!("No DATABASE_URL provided, and {:?} is not writeable. Using a temporary in-memory SQLite database. All the data created will be lost when this server shuts down.", configuration_directory);
436-
prefix + ":memory:"
436+
prefix + ":memory:?cache=shared"
437437
}
438438

439439
fn encode_uri(path: &Path) -> std::borrow::Cow<str> {

src/webserver/database/connect.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ impl Database {
6565
AnyKind::MySql => 75,
6666
AnyKind::Sqlite => {
6767
if config.database_url.contains(":memory:") {
68-
// Create no more than a single in-memory database connection
69-
1
68+
128
7069
} else {
7170
16
7271
}

0 commit comments

Comments
 (0)