mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 09:09:07 -05:00
improvement: extend allowed wal_checkpoint timeout to 10 sec
This commit is contained in:
parent
b23b3ce8ec
commit
d2adddaee4
|
@ -721,7 +721,7 @@ pub async fn db_checkpoint_task(pool: SqlitePool, safe_to_read: Arc<Mutex<u64>>)
|
||||||
// default threshold for the busy timer
|
// default threshold for the busy timer
|
||||||
let busy_wait_default = Duration::from_secs(1);
|
let busy_wait_default = Duration::from_secs(1);
|
||||||
// if the WAL file is getting too big, switch to this
|
// 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 {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::time::sleep(Duration::from_secs(CHECKPOINT_FREQ_SEC)) => {
|
_ = tokio::time::sleep(Duration::from_secs(CHECKPOINT_FREQ_SEC)) => {
|
||||||
|
|
|
@ -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.
|
// acquire and immediately release lock; this ensures we do not start new queries during a wal checkpoint.
|
||||||
let _ = safe_to_read.lock().await;
|
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.
|
// 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;
|
db::db_query(s, cid.to_owned(), pool.clone(), query_tx.clone(), abandon_query_rx).await;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user