remove highest ping (#1081)

This commit is contained in:
Logan McNaughton 2026-06-15 15:02:29 +02:00 committed by GitHub
parent 90e51f5f09
commit 4929f2cc51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -654,6 +654,7 @@ fn update_ping(
if pings.len() > message.num_of_peers * 4 {
// once we have enough samples, average the 3 highest values
pings.sort_by(f64::total_cmp);
pings.pop(); // Remove highest value to avoid outliers
let ping_avg = pings.iter().rev().take(3).sum::<f64>() / 3.0;
pings.clear();
weak_app