aboutsummaryrefslogtreecommitdiff
path: root/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs
index a1d86c9..266199b 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -21,6 +21,7 @@ pub struct AdInfo {
pub struct Config {
bloom_filter_size: usize,
impression_weight_falloff: f64,
+ leaderboard_weight_threshold: f64,
pub image_base: PathBuf,
database_path: PathBuf,
pub port: u16,
@@ -103,7 +104,12 @@ impl Logic {
}
d.sort_by_key(|(_, _, w)| OrdAnyway(-*w));
- while d.len() > 16 {
+ while d
+ .last()
+ .map(|l| l.2 < self.config.leaderboard_weight_threshold)
+ .unwrap_or_default()
+ || d.len() > 64
+ {
d.pop();
}