Skip to content

Commit

Permalink
Add an upper limit to number of recently accessed releases that will …
Browse files Browse the repository at this point in the history
…be tracked
  • Loading branch information
Nemo157 committed Oct 22, 2020
1 parent 34c1f5b commit 22ae1da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ impl RecentlyAccessedReleases {
}

pub(crate) fn record(&self, krate: i32, version: i32, target: &str) {
if self.platforms.len() > 100_000 {
// Avoid filling the maps _too_ much, we should never get anywhere near this limit
return;
}

let now = Instant::now();
self.crates.insert(krate, now);
self.versions.insert(version, now);
Expand Down

0 comments on commit 22ae1da

Please sign in to comment.