Live video on the AT Protocol

leak: exponential backoff?

+22 -6
+1 -1
go.mod
··· 18 github.com/ThalesGroup/crypto11 v0.0.0-00010101000000-000000000000 19 github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d 20 github.com/bluesky-social/indigo v0.0.0-20250520232546-236dd575c91e 21 github.com/decred/dcrd/dcrec/secp256k1 v1.0.4 22 github.com/dunglas/httpsfv v1.0.2 23 github.com/ethereum/go-ethereum v1.14.7 ··· 59 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 60 go.opentelemetry.io/otel/sdk v1.35.0 61 go.opentelemetry.io/otel/trace v1.35.0 62 - go.uber.org/goleak v1.3.0 63 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 64 golang.org/x/image v0.22.0 65 golang.org/x/net v0.39.0
··· 18 github.com/ThalesGroup/crypto11 v0.0.0-00010101000000-000000000000 19 github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d 20 github.com/bluesky-social/indigo v0.0.0-20250520232546-236dd575c91e 21 + github.com/cenkalti/backoff/v5 v5.0.2 22 github.com/decred/dcrd/dcrec/secp256k1 v1.0.4 23 github.com/dunglas/httpsfv v1.0.2 24 github.com/ethereum/go-ethereum v1.14.7 ··· 60 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 61 go.opentelemetry.io/otel/sdk v1.35.0 62 go.opentelemetry.io/otel/trace v1.35.0 63 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 64 golang.org/x/image v0.22.0 65 golang.org/x/net v0.39.0
+2
go.sum
··· 147 github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= 148 github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= 149 github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= 150 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 151 github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= 152 github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
··· 147 github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= 148 github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= 149 github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= 150 + github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= 151 + github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= 152 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 153 github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= 154 github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
+19 -5
pkg/media/leak_test.go
··· 16 "time" 17 18 "github.com/acarl005/stripansi" 19 "github.com/stretchr/testify/require" 20 "stream.place/streamplace/pkg/gstinit" 21 ) ··· 103 os.Exit(m.Run()) 104 } 105 106 func getLeakCount(t *testing.T) int { 107 if os.Getenv(IgnoreLeaks) != "" { 108 return 0 109 } ··· 116 117 // we want CI to be extra reliable here and a little slower is okay 118 flushes := 2 119 - if os.Getenv("CI") != "" { 120 - flushes = 5 121 - } 122 123 for range flushes { 124 ch := make(chan struct{}) ··· 143 <-ch 144 }() 145 } 146 - 147 - time.Sleep(time.Duration(flushes) * time.Second) 148 149 err = process.Signal(os.Signal(syscall.SIGUSR1)) 150 require.NoError(t, err)
··· 16 "time" 17 18 "github.com/acarl005/stripansi" 19 + "github.com/cenkalti/backoff/v5" 20 "github.com/stretchr/testify/require" 21 "stream.place/streamplace/pkg/gstinit" 22 ) ··· 104 os.Exit(m.Run()) 105 } 106 107 + // Often the GC is instance, but sometimes it takes a while. So, we retry a few times 108 + // with exponential backoff, giving the GC more time to do its thing. 109 func getLeakCount(t *testing.T) int { 110 + ticker := backoff.NewTicker(backoff.NewExponentialBackOff()) 111 + defer ticker.Stop() 112 + var leaks int 113 + for i := 0; i < 10; i++ { 114 + leaks = getLeakCountInner(t) 115 + if leaks == 0 { 116 + return leaks 117 + } 118 + if i < 9 { 119 + <-ticker.C 120 + } 121 + } 122 + return leaks 123 + } 124 + 125 + func getLeakCountInner(t *testing.T) int { 126 if os.Getenv(IgnoreLeaks) != "" { 127 return 0 128 } ··· 135 136 // we want CI to be extra reliable here and a little slower is okay 137 flushes := 2 138 139 for range flushes { 140 ch := make(chan struct{}) ··· 159 <-ch 160 }() 161 } 162 163 err = process.Signal(os.Signal(syscall.SIGUSR1)) 164 require.NoError(t, err)