mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-09 21:29:06 -05:00
refactor: formatting
This commit is contained in:
parent
cb2ac4bf0f
commit
2e22334631
26
src/db.rs
26
src/db.rs
|
@ -695,19 +695,19 @@ pub async fn db_maintenance(pool: SqlitePool) {
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::time::sleep(Duration::from_secs(EVENT_MAINTENANCE_FREQ_SEC)) => {
|
_ = tokio::time::sleep(Duration::from_secs(EVENT_MAINTENANCE_FREQ_SEC)) => {
|
||||||
if let Ok(mut conn) = pool.get() {
|
if let Ok(mut conn) = pool.get() {
|
||||||
// the busy timer will block writers, so don't set
|
// the busy timer will block writers, so don't set
|
||||||
// this any higher than you want max latency for event
|
// this any higher than you want max latency for event
|
||||||
// writes.
|
// writes.
|
||||||
conn.busy_timeout(Duration::from_secs(1)).ok();
|
conn.busy_timeout(Duration::from_secs(1)).ok();
|
||||||
debug!("running database optimizer");
|
debug!("running database optimizer");
|
||||||
optimize_db(&mut conn).ok();
|
optimize_db(&mut conn).ok();
|
||||||
debug!("running wal_checkpoint(TRUNCATE)");
|
debug!("running wal_checkpoint(TRUNCATE)");
|
||||||
checkpoint_db(&mut conn).ok();
|
checkpoint_db(&mut conn).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user