|
|
|
@ -970,9 +970,9 @@ impl Database { |
|
|
|
use tokio::time::sleep; |
|
|
|
use tokio::time::sleep; |
|
|
|
|
|
|
|
|
|
|
|
tokio::spawn(async move { |
|
|
|
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 { |
|
|
|
loop { |
|
|
|
sleep(Duration::from_secs(interval)).await; |
|
|
|
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 pruned { |
|
|
|
if interval > 1 { |
|
|
|
if interval > 1 { |
|
|
|
interval /= 2; |
|
|
|
interval /= 2; |
|
|
|
|