feat: 重建 MediaMTX 生命周期与状态对账 (#67)

This commit is contained in:
QiuSW
2026-08-14 17:42:26 +08:00
parent 24cf4bbd65
commit 19f9bfa1a0
26 changed files with 1560 additions and 0 deletions
@@ -0,0 +1,17 @@
package reconcile
import "time"
func Backoff(failures int) time.Duration {
if failures <= 1 {
return time.Second
}
d := time.Second
for i := 1; i < failures; i++ {
if d >= 30*time.Second {
return time.Minute
}
d *= 2
}
return d
}
@@ -0,0 +1,12 @@
package reconcile
import (
"testing"
"time"
)
func TestBackoffIsBounded(t *testing.T) {
if Backoff(1) != time.Second || Backoff(4) != 8*time.Second || Backoff(20) != time.Minute {
t.Fatal("unexpected retry backoff")
}
}