improvement: extend allowed wal_checkpoint timeout to 10 sec

This commit is contained in:
Greg Heartsfield 2022-12-27 10:13:14 -06:00
parent b23b3ce8ec
commit d2adddaee4
2 changed files with 3 additions and 2 deletions

View File

@ -721,7 +721,7 @@ pub async fn db_checkpoint_task(pool: SqlitePool, safe_to_read: Arc<Mutex<u64>>)
// default threshold for the busy timer
let busy_wait_default = Duration::from_secs(1);
// if the WAL file is getting too big, switch to this
let busy_wait_default_long = Duration::from_secs(5);
let busy_wait_default_long = Duration::from_secs(10);
loop {
tokio::select! {
_ = tokio::time::sleep(Duration::from_secs(CHECKPOINT_FREQ_SEC)) => {

View File

@ -690,6 +690,7 @@ async fn nostr_server(
{
// acquire and immediately release lock; this ensures we do not start new queries during a wal checkpoint.
let _ = safe_to_read.lock().await;
trace!("passed safe_to_read lock");
}
// start a database query. this spawns a blocking database query on a worker thread.
db::db_query(s, cid.to_owned(), pool.clone(), query_tx.clone(), abandon_query_rx).await;