From ce3e61a39a45b861b53f4fa102df18a4d333f005 Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Wed, 6 Mar 2024 18:01:39 -0500
Subject: [PATCH] document cleanup_second_interval, change default to 1800
 seconds

Signed-off-by: strawberry <strawberry@puppygock.gay>
---
 conduwuit-example.toml | 15 ++++++++++++++-
 src/config/mod.rs      |  4 ++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/conduwuit-example.toml b/conduwuit-example.toml
index c88aaac70..fcab2a91e 100644
--- a/conduwuit-example.toml
+++ b/conduwuit-example.toml
@@ -248,6 +248,10 @@ allow_check_for_updates = true
 # Defaults to true as this is the fastest option for federation.
 #query_trusted_key_servers_first = true
 
+
+
+### Generic database options
+
 # Set this to any float value to multiply conduwuit's in-memory LRU caches with.
 # May be useful if you have significant memory to spare to increase performance.
 # Defaults to 1.0.
@@ -258,6 +262,15 @@ allow_check_for_updates = true
 # Defaults to 300.0
 #db_cache_capacity_mb = 300.0
 
+# Interval in seconds when conduwuit will run database cleanup operations.
+#
+# For SQLite: this will flush the WAL by executing `PRAGMA wal_checkpoint(RESTART)` (https://www.sqlite.org/pragma.html#pragma_wal_checkpoint)
+# For RocksDB: this will run `flush_opt` to flush database memtables to SST files on disk (https://docs.rs/rocksdb/latest/rocksdb/struct.DBCommon.html#method.flush_opt)
+# These operations always run on shutdown.
+#
+# Defaults to 30 minutes (1800 seconds) to avoid IO amplification from too frequent cleanups
+#cleanup_second_interval = 1800
+
 
 
 ### RocksDB options
@@ -275,7 +288,7 @@ allow_check_for_updates = true
 
 # RocksDB log level. This is not the same as conduwuit's log level. This is the log level for RocksDB itself
 # which show up in your database folder/path as `LOG` files. Defaults to warn. conduwuit will typically log RocksDB errors. 
-#rocksdb_log_level = "warn"
+#rocksdb_log_level = "error"
 
 # Max RocksDB `LOG` file size before rotating in bytes. Defaults to 4MB.
 #rocksdb_max_log_file_size = 4194304
diff --git a/src/config/mod.rs b/src/config/mod.rs
index c5387dcf7..ba2cdcbea 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -294,7 +294,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 					None => "not set",
 				},
 			),
-			("Trusted servers", {
+			("Trusted key servers", {
 				let mut lst = vec![];
 				for server in &self.trusted_servers {
 					lst.push(server.host());
@@ -416,7 +416,7 @@ fn default_conduit_cache_capacity_modifier() -> f64 { 1.0 }
 fn default_pdu_cache_capacity() -> u32 { 150_000 }
 
 fn default_cleanup_second_interval() -> u32 {
-	60 // every minute
+	1800 // every 30 minutes
 }
 
 fn default_max_request_size() -> u32 {
-- 
GitLab