reducing the channel sizes so data doesn't pile up and frames are dropped instead

This commit is contained in:
2026-06-24 16:05:03 +01:00
parent 5b77b5b941
commit 2ae29af199
4 changed files with 10 additions and 11 deletions
+5
View File
@@ -53,6 +53,11 @@ normally until it hangs.
- Go back to Terminal2 to and do a `Ctrl+c` to capture the state and then check
what went wrong by looking at the `goroutines` for example.
pprof:
- `go tool pprof http://localhost:8001/debug/pprof/mutex`
- type `top` to view the summary
- type `web` to view a graph version
### Shameless begging
Hey, doesn't hurt to try, its free either way:
+1 -1
View File
@@ -69,7 +69,7 @@ func NewIRacingProvider(
logger: logger,
SDK: sdk,
data: telem.NewTelemetryData(),
streamCh: make(chan telem.TelemetryData),
streamCh: make(chan telem.TelemetryData, 1),
// NOTE: This is because I stupidly recorded a test IBT file in 240
ticker: time.NewTicker(time.Second / 240),
}, nil
+1 -7
View File
@@ -27,7 +27,7 @@ func NewTelemetryService(logger *slog.Logger, cdash *CDashService) *TelemetrySer
newService := &TelemetryService{
logger: logger,
cdash: cdash,
uiOutCh: make(chan telem.TelemetryData, 100),
uiOutCh: make(chan telem.TelemetryData, 5),
listeners: make(map[string]chan telem.TelemetryData),
}
@@ -78,12 +78,6 @@ func (t *TelemetryService) multiplexData(ctx context.Context, dataCh <-chan tele
}
}
t.mut.RUnlock()
select {
case t.uiOutCh <- data:
default:
// Control latency
}
}
}
}
+3 -3
View File
@@ -48,7 +48,7 @@ func NewStreamingCtrl(
TelemServ: serTelem,
Messages: make(chan string, 10),
Internal: make(chan string, 10),
TelemetryCh: make(chan telemetry.TelemetryData, 100),
TelemetryCh: make(chan telemetry.TelemetryData, 1),
Run: false,
StreamView: streamView,
isRunning: false,
@@ -62,7 +62,7 @@ func NewStreamingCtrl(
}
func (sc *StreamingCtrl) subscribeListeners() {
sc.TelemetryCh = sc.TelemServ.SubscribeListener("UI", 50)
sc.TelemetryCh = sc.TelemServ.SubscribeListener("UI", 1)
}
func (sc *StreamingCtrl) registerHooks() {
@@ -109,7 +109,7 @@ func (sc *StreamingCtrl) StartStop() {
// NOTE:
// Subscribe the only existing device - needs to be discovered by now
slog.Debug("setting the data stream for cdash")
sc.Service.SetTelemetryChannel(sc.TelemServ.SubscribeListener("cdash", 50))
sc.Service.SetTelemetryChannel(sc.TelemServ.SubscribeListener("cdash", 1))
slog.Debug("starting to stream data again")
sc.Service.StartStream()