From 1e539510c06a2351c96d4d961eee12d98aaa786c Mon Sep 17 00:00:00 2001 From: Leo Camus Date: Tue, 22 Sep 2026 07:34:53 +0200 Subject: [PATCH] ccutils: use millisecond resolution for probe interval backoff (#4891) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ccutils: use millisecond resolution for probe interval backoff ProbeSignal grew probeInterval via Seconds(), which truncates the float to the nearest nanosecond before scaling by time.Second: time.Duration(probeInterval.Seconds() * BackoffFactor) * time.Second With BackoffFactor=1.5 and the default BaseInterval of 3 s, the first congestion signal produced 4 s instead of 4.5 s, and the error compounded on every subsequent signal (4 s → 6 s → 9 s → 13 s ... instead of 4.5 s → 6.75 s → 10.125 s ...). The interval converges to MaxInterval later than intended, so the server probes more frequently during sustained congestion than the configuration requests. probeDuration in the same function already uses the correct idiom: time.Duration(float64(probeDuration.Milliseconds()) * Factor) * time.Millisecond Apply the same pattern to probeInterval so both fields are computed consistently with millisecond precision. Found by a defect-hunting pipeline I build and run ([Dev-next-gen](https://github.com/Dev-next-gen)), using Claude Code with Anthropic's Claude Opus 5. * ccutils: remove probe interval backoff test Requested by reviewer. --- pkg/sfu/ccutils/probe_regulator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sfu/ccutils/probe_regulator.go b/pkg/sfu/ccutils/probe_regulator.go index ed0940bd9..5804404b1 100644 --- a/pkg/sfu/ccutils/probe_regulator.go +++ b/pkg/sfu/ccutils/probe_regulator.go @@ -80,7 +80,7 @@ func (p *ProbeRegulator) ProbeDuration() time.Duration { func (p *ProbeRegulator) ProbeSignal(probeSignal ProbeSignal, baseTime time.Time) { if probeSignal == ProbeSignalCongesting { // wait longer till next probe - p.probeInterval = time.Duration(p.probeInterval.Seconds()*p.params.Config.BackoffFactor) * time.Second + p.probeInterval = time.Duration(float64(p.probeInterval.Milliseconds())*p.params.Config.BackoffFactor) * time.Millisecond if p.probeInterval > p.params.Config.MaxInterval { p.probeInterval = p.params.Config.MaxInterval }