refactor(go): avoid duplicate realtime protocol payloads
This commit is contained in:
@@ -92,7 +92,6 @@ func (r *Repository) Update(ctx context.Context, env envelope.FrameEnvelope) err
|
||||
VIN: vin,
|
||||
Fields: map[string]any{},
|
||||
FieldTimesMS: map[string]int64{},
|
||||
ProtocolData: map[envelope.Protocol]map[string]any{},
|
||||
}
|
||||
} else if merged.VIN == "" && vin != "" {
|
||||
merged.VIN = vin
|
||||
@@ -105,10 +104,6 @@ func (r *Repository) Update(ctx context.Context, env envelope.FrameEnvelope) err
|
||||
merged.SourceEndpoint = env.SourceEndpoint
|
||||
}
|
||||
merged.Protocols = protocols
|
||||
if merged.ProtocolData == nil {
|
||||
merged.ProtocolData = map[envelope.Protocol]map[string]any{}
|
||||
}
|
||||
merged.ProtocolData[env.Protocol] = cloneMap(protocolSnapshot.Parsed)
|
||||
merged.UpdatedAtMS = nowMS
|
||||
if err := r.setJSON(ctx, mergedKey(vehicleKey), merged, r.cfg.ttl()); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user