cleaning tasks: run shrink_to_fit on connection and torrent maps

This commit is contained in:
Joakim Frostegård 2020-04-05 19:22:41 +02:00
parent 70b5795818
commit d601025286
2 changed files with 6 additions and 2 deletions

View file

@ -2,8 +2,9 @@
* Configuration, cli
* Tests
* Optimize extract_response_peers
* Clean connections: `state.connections.shrink_to_fit()`?
* extract_response_peers
* Cleaner code
* Stack-allocated vector?
## Don't do

View file

@ -8,6 +8,7 @@ pub fn clean_connections(state: &State){
let limit = Instant::now() - Duration::from_secs(300);
state.connections.retain(|_, v| v.0 > limit);
state.connections.shrink_to_fit();
}
@ -38,4 +39,6 @@ pub fn clean_torrents(state: &State){
!torrent.peers.is_empty()
});
state.torrents.shrink_to_fit();
}