Play with thresholds some more

This commit is contained in:
Vecna 2024-06-29 16:21:13 -04:00
parent aab51731e1
commit 58de633f3d
1 changed files with 7 additions and 18 deletions

View File

@ -1,8 +1,8 @@
use crate::{analysis::Analyzer, BridgeCountryInfo, BridgeInfoType}; use crate::analysis::Analyzer;
use lox_library::{ use lox_library::{
bridge_table::MAX_BRIDGES_PER_BUCKET, bridge_table::MAX_BRIDGES_PER_BUCKET,
proto::{ proto::{
level_up::{LEVEL_INTERVAL, LEVEL_INVITATIONS, MAX_LEVEL}, level_up::{LEVEL_INTERVAL, LEVEL_INVITATIONS},
trust_promotion::UNTRUSTED_INTERVAL, trust_promotion::UNTRUSTED_INTERVAL,
}, },
OPENINV_K, OPENINV_K,
@ -43,7 +43,7 @@ fn max_negative_reports(days: u32) -> u32 {
// Based on that, allow this many negative reports // Based on that, allow this many negative reports
if max_users <= 10 { if max_users <= 10 {
0 1
} else if max_users <= 30 { } else if max_users <= 30 {
5 5
} else { } else {
@ -53,7 +53,7 @@ fn max_negative_reports(days: u32) -> u32 {
fn too_few_bridge_ips( fn too_few_bridge_ips(
days: u32, days: u32,
max_bridge_ips: u32, _max_bridge_ips: u32,
bridge_ips_today: u32, bridge_ips_today: u32,
positive_reports_today: u32, positive_reports_today: u32,
) -> bool { ) -> bool {
@ -63,28 +63,17 @@ fn too_few_bridge_ips(
// Based on that, expect this many bridge ips // Based on that, expect this many bridge ips
let min_bip = if max_users <= 16 { let min_bip = if max_users <= 16 {
// expect 10 // expect 10
8 0
} else if max_users <= 40 { } else if max_users <= 40 {
// expect 30 // expect 30
16 8
} else if max_users <= 96 { } else if max_users <= 96 {
// expect 90 // expect 90
24 16
} else { } else {
// also 32, but it could be something else
32 32
}; };
// If we normally see low usage, halve the minimum
let min_bip = if max_bridge_ips <= 8 {
// If we have 1-8 users, allow the number to be 0
0
} else if max_bridge_ips <= max_users / 2 {
min_bip / 2
} else {
min_bip
};
// If we see positive reports from trusted users, halve the minimum // If we see positive reports from trusted users, halve the minimum
let min_bip = if positive_reports_today > 0 { let min_bip = if positive_reports_today > 0 {
min_bip / 2 min_bip / 2