Skip to content

Commit

Permalink
Don't serialize task states twice in state files
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Sep 2, 2016
1 parent 8d9468d commit 8cb85ed
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions client/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ type allocRunnerState struct {
Alloc *structs.Allocation
AllocClientStatus string
AllocClientDescription string
TaskStates map[string]*structs.TaskState
Context *driver.ExecContext
}

Expand Down Expand Up @@ -121,7 +120,7 @@ func (r *AllocRunner) RestoreState() error {
r.ctx = snap.Context
r.allocClientStatus = snap.AllocClientStatus
r.allocClientDescription = snap.AllocClientDescription
r.taskStates = snap.TaskStates
r.taskStates = snap.Alloc.TaskStates

var snapshotErrors multierror.Error
if r.alloc == nil {
Expand Down Expand Up @@ -189,7 +188,6 @@ func (r *AllocRunner) saveAllocRunnerState() error {
alloc := r.Alloc()

r.allocLock.Lock()
states := alloc.TaskStates
allocClientStatus := r.allocClientStatus
allocClientDescription := r.allocClientDescription
r.allocLock.Unlock()
Expand All @@ -204,7 +202,6 @@ func (r *AllocRunner) saveAllocRunnerState() error {
Context: ctx,
AllocClientStatus: allocClientStatus,
AllocClientDescription: allocClientDescription,
TaskStates: states,
}
return persistState(r.stateFilePath(), &snap)
}
Expand Down

0 comments on commit 8cb85ed

Please sign in to comment.