engine: graph: Refactor the send/recv code to inline it

This is useful subsequently.
This commit is contained in:
James Shubin
2023-11-12 16:13:04 -05:00
parent cb6b8a9670
commit 4fb356b19b

View File

@@ -128,14 +128,17 @@ func (obj *Engine) SendRecv(res engine.RecvableRes) (map[string]bool, error) {
}
// if the values aren't equal, we're changing the receiver
if !reflect.DeepEqual(value1.Interface(), value2.Interface()) {
if reflect.DeepEqual(value1.Interface(), value2.Interface()) {
continue // skip as they're the same, no error needed
}
// TODO: can we catch the panics here in case they happen?
value2.Set(value1) // do it for all types that match
updated[k] = true // we updated this key!
v.Changed = true // tag this key as updated!
obj.Logf("SendRecv: %s.%s -> %s.%s", v.Res, v.Key, res, k)
}
}
return updated, err
}