aquatic_udp: split cleaning interval for connections and torrents

This commit is contained in:
Joakim Frostegård 2021-11-03 00:07:52 +01:00
parent 5f10e5e7f4
commit afe3e2465f
5 changed files with 20 additions and 13 deletions

View file

@ -127,11 +127,11 @@ pub async fn run_socket_worker(
let pending_scrape_responses = Rc::new(RefCell::new(PendingScrapeResponses::default()));
// Periodically clean pending_scrape_responses
TimerActionRepeat::repeat(enclose!((config, pending_scrape_responses) move || {
enclose!((config, pending_scrape_responses) move || async move {
TimerActionRepeat::repeat(enclose!((pending_scrape_responses) move || {
enclose!((pending_scrape_responses) move || async move {
pending_scrape_responses.borrow_mut().clean();
Some(Duration::from_secs(config.cleaning.interval))
Some(Duration::from_secs(120))
})()
}));
@ -201,7 +201,7 @@ async fn read_requests(
enclose!((config, connections) move || async move {
connections.borrow_mut().clean();
Some(Duration::from_secs(config.cleaning.interval))
Some(Duration::from_secs(config.cleaning.connection_cleaning_interval))
})()
}));