perf(baseliner): bound the reselection channel to prevent memory buildup

Change the reselection channel from unbounded to a size of 1 and use non-blocking sends to avoid unnecessary queuing of reselection triggers.
This commit is contained in:
Nils Andreas Svee committed 2026-07-17 11:39:07 +07:00
1 parent 9811592f13
commit 50f0dcb4dd
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -122,9 +122,9 @@ impl Baseliner {
reflector: Some(time_data.reflector),
tags: &[],
});
// If reselection is disabled this would trigger an error
// so just ignore the result
let _ = self.reselect_trigger.send(true);
// The reselect channel is bounded to 1,
// so we use try_send to avoid blocking if the channel is full
let _ = self.reselect_trigger.try_send(true);
} else {
owd_baseline.down_ewma = owd_baseline.down_ewma * slow_factor
+ (1.0 - slow_factor) * time_data.down_time;