From 83e9655c0c2ff6e609cba8e4499cf0527f31a0ed Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Tue, 23 Nov 2021 19:13:11 +0100 Subject: [PATCH] add comments and fix type --- src/database.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/database.rs b/src/database.rs index c198f0e..4177b1a 100644 --- a/src/database.rs +++ b/src/database.rs @@ -970,9 +970,9 @@ impl Database { use tokio::time::sleep; tokio::spawn(async move { - let mut interval: usize = 15; + let mut interval: u64 = 15; - const MAX_PRUNE_INTERVAL_SECS: usize = 60; + const MAX_PRUNE_INTERVAL_SECS: u64 = 60; loop { sleep(Duration::from_secs(interval)).await; @@ -985,6 +985,8 @@ impl Database { } } + // Will half the next interval if it found anything (until its 1 second) + // Will add one second to next interval if it didn't find anything (until its >=MAX_PRUNE_INTERVAL_SECS) if pruned { if interval > 1 { interval /= 2;