Skip to content

Commit

Permalink
fix: correct copy back logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Aug 19, 2021
1 parent bf719d9 commit d7f9eb4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions runner/sidecar/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,24 @@ func patchStepStatus() {
if v.Status.SinkStatues == nil {
v.Status.SinkStatues = dfv1.SourceStatuses{}
}
// the step with change while this goroutine is running, so we must copy the data for this
// the step will change while this goroutine is running, so we must copy the data for this
// replica back to the status
r := strconv.Itoa(replica)
for name, s := range step.Status.SourceStatuses {
if v.Status.SourceStatuses[name].Metrics == nil {
s.Metrics = map[string]dfv1.Metrics{}
x := v.Status.SourceStatuses[name]
x.Metrics = map[string]dfv1.Metrics{}
v.Status.SourceStatuses[name] = x
}
v.Status.SourceStatuses[name] = s
v.Status.SourceStatuses[name].Metrics[r] = s.Metrics[r]
}
for name, s := range step.Status.SinkStatues {
if v.Status.SinkStatues[name].Metrics == nil {
s.Metrics = map[string]dfv1.Metrics{}
x := v.Status.SinkStatues[name]
x.Metrics = map[string]dfv1.Metrics{}
v.Status.SinkStatues[name] = x
}
v.Status.SinkStatues[name] = s
v.Status.SinkStatues[name].Metrics[r] = s.Metrics[r]
}
step = v
})
Expand Down

0 comments on commit d7f9eb4

Please sign in to comment.