Skip to content

Commit

Permalink
more comments from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed May 9, 2023
1 parent a5e1d12 commit b81d349
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions client/allocrunner/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1446,12 +1446,9 @@ func (ar *allocRunner) LastAcknowledgedStateIsCurrent(a *structs.Allocation) boo
return false
}

for taskName, taskState := range last.TaskStates {
newTaskState, ok := a.TaskStates[taskName]
if !ok || !taskState.Equal(newTaskState) {
return false
}
}
maps.EqualFunc(last.TaskStates, a.TaskStates, func(st, o *structs.TaskState) bool {
return st.Equal(o)
})

return true
}
9 changes: 3 additions & 6 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8473,17 +8473,14 @@ func (ts *TaskState) Equal(o *TaskState) bool {
if ts.FinishedAt != o.FinishedAt {
return false
}
if len(ts.Events) != len(o.Events) {
if !slices.EqualFunc(ts.Events, o.Events, func(ts, o *TaskEvent) bool {
return ts.Equal(o)
}) {
return false
}
if !ts.TaskHandle.Equal(o.TaskHandle) {
return false
}
for i, tsEvent := range ts.Events {
if !tsEvent.Equal(o.Events[i]) {
return false
}
}

return true
}
Expand Down

0 comments on commit b81d349

Please sign in to comment.