aboutsummaryrefslogtreecommitdiff
path: root/src/state.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-20 16:08:57 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-20 16:08:57 +0200
commit270283eb61716fa51c0c9b96ef3e00d23eb94dc9 (patch)
treeaf50329912c2a699ef168f7915236f5d68a8a22e /src/state.rs
parent9cfb8a07ad4f7413a37ec316f422938e672163f2 (diff)
downloadmeta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar
meta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar.bz2
meta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar.zst
add more info
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();
}