mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 00:59:07 -05:00
fix: do not run auto_vacuum on read-only connections
This commit is contained in:
parent
b7c8737166
commit
3dd0f2c9c6
|
@ -364,6 +364,9 @@ pub async fn db_writer(
|
||||||
|
|
||||||
/// Persist an event to the database, returning rows added.
|
/// Persist an event to the database, returning rows added.
|
||||||
pub fn write_event(conn: &mut PooledConnection, e: &Event) -> Result<usize> {
|
pub fn write_event(conn: &mut PooledConnection, e: &Event) -> Result<usize> {
|
||||||
|
// enable auto vacuum
|
||||||
|
conn.execute_batch("pragma auto_vacuum = FULL")?;
|
||||||
|
|
||||||
// start transaction
|
// start transaction
|
||||||
let tx = conn.transaction()?;
|
let tx = conn.transaction()?;
|
||||||
// get relevant fields from event and convert to blobs.
|
// get relevant fields from event and convert to blobs.
|
||||||
|
|
|
@ -14,7 +14,6 @@ use tracing::{debug, error, info};
|
||||||
/// Startup DB Pragmas
|
/// Startup DB Pragmas
|
||||||
pub const STARTUP_SQL: &str = r##"
|
pub const STARTUP_SQL: &str = r##"
|
||||||
PRAGMA main.synchronous = NORMAL;
|
PRAGMA main.synchronous = NORMAL;
|
||||||
PRAGMA auto_vacuum = FULL;
|
|
||||||
PRAGMA foreign_keys = ON;
|
PRAGMA foreign_keys = ON;
|
||||||
PRAGMA journal_size_limit = 32768;
|
PRAGMA journal_size_limit = 32768;
|
||||||
pragma mmap_size = 17179869184; -- cap mmap at 16GB
|
pragma mmap_size = 17179869184; -- cap mmap at 16GB
|
||||||
|
@ -28,7 +27,7 @@ const INIT_SQL: &str = formatcp!(
|
||||||
r##"
|
r##"
|
||||||
-- Database settings
|
-- Database settings
|
||||||
PRAGMA encoding = "UTF-8";
|
PRAGMA encoding = "UTF-8";
|
||||||
PRAGMA journal_mode=WAL;
|
PRAGMA journal_mode = WAL;
|
||||||
PRAGMA auto_vacuum = FULL;
|
PRAGMA auto_vacuum = FULL;
|
||||||
PRAGMA main.synchronous=NORMAL;
|
PRAGMA main.synchronous=NORMAL;
|
||||||
PRAGMA foreign_keys = ON;
|
PRAGMA foreign_keys = ON;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user