From f50fc7a87bcf886d60459a9e9e78bcc9154a475e Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Sat, 14 Mar 2026 21:45:50 +0000 Subject: [PATCH] BUG FIX - multiple binds for a given event were created when many windows wanted it --- providers/iracing/iracing.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/providers/iracing/iracing.go b/providers/iracing/iracing.go index 2d944cc..2088d1c 100644 --- a/providers/iracing/iracing.go +++ b/providers/iracing/iracing.go @@ -127,7 +127,16 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) { i.data.ActiveBinds = make([]telem.BoundField, 0, len(requestFields)) + boundCheck := make(map[telem.FieldID]bool) + for winID, id := range requestFields { + i.data.Values[id].IDs = append(i.data.Values[id].IDs, winID) + + // Check if we already bound this FieldID + if boundCheck[id] { + continue + } + // Translate the UI FieldIDs to this provider's field names sdkKey, ok := internalToSDKFieldNames[id] if !ok { @@ -189,8 +198,8 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) { } } - i.data.Values[id].IDs = append(i.data.Values[id].IDs, winID) i.data.ActiveBinds = append(i.data.ActiveBinds, binding) + boundCheck[id] = true } i.logger.Debug(fmt.Sprintf("Subscribed: %+v\n", i.data.ActiveBinds))