Skip to content

Commit 957d52f

Browse files
committed
progress: don't modify ResetTime inputs
No other parts of the progress rendering modify the inputs, so we should avoid this as well. This actually fixes an edge case in pushWithMoby which writes the same VertexStatus multiple times, modifying the timestamps and similar. However, if the operation takes long enough the small time difference can accumulate, and move the Start time far into the past. Signed-off-by: Justin Chadwell <[email protected]>
1 parent 8656037 commit 957d52f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

util/progress/progresswriter/reset.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ func ResetTime(in Writer) Writer {
2727
}
2828
}
2929
if w.diff != nil {
30+
vertexes := make([]*client.Vertex, 0, len(st.Vertexes))
3031
for _, v := range st.Vertexes {
32+
v := *v
3133
if v.Started != nil {
3234
d := v.Started.Add(-*w.diff)
3335
v.Started = &d
@@ -36,8 +38,12 @@ func ResetTime(in Writer) Writer {
3638
d := v.Completed.Add(-*w.diff)
3739
v.Completed = &d
3840
}
41+
vertexes = append(vertexes, &v)
3942
}
43+
44+
statuses := make([]*client.VertexStatus, 0, len(st.Statuses))
4045
for _, v := range st.Statuses {
46+
v := *v
4147
if v.Started != nil {
4248
d := v.Started.Add(-*w.diff)
4349
v.Started = &d
@@ -47,9 +53,21 @@ func ResetTime(in Writer) Writer {
4753
v.Completed = &d
4854
}
4955
v.Timestamp = v.Timestamp.Add(-*w.diff)
56+
statuses = append(statuses, &v)
5057
}
58+
59+
logs := make([]*client.VertexLog, 0, len(st.Logs))
5160
for _, v := range st.Logs {
61+
v := *v
5262
v.Timestamp = v.Timestamp.Add(-*w.diff)
63+
logs = append(logs, &v)
64+
}
65+
66+
st = &client.SolveStatus{
67+
Vertexes: vertexes,
68+
Statuses: statuses,
69+
Logs: logs,
70+
Warnings: st.Warnings,
5371
}
5472
}
5573
in.Status() <- st

0 commit comments

Comments
 (0)