compile
This commit is contained in:
parent
6ebdf532ea
commit
e1ba73b515
|
@ -494,7 +494,7 @@ func (tr *TaskRunner) Restore(tx *bolt.Tx) error {
|
||||||
if err := clientstate.GetObject(bkt, taskStateKey, &ts); err != nil {
|
if err := clientstate.GetObject(bkt, taskStateKey, &ts); err != nil {
|
||||||
return fmt.Errorf("failed to read task state: %v", err)
|
return fmt.Errorf("failed to read task state: %v", err)
|
||||||
}
|
}
|
||||||
tr.state = &tr
|
tr.state = &ts
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ func (tr *TaskRunner) SetState(state string, event *structs.TaskEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append the event
|
// Append the event
|
||||||
tr.emitEventImpl(tx, event)
|
tr.emitEventImpl(event)
|
||||||
|
|
||||||
// Handle the state transition.
|
// Handle the state transition.
|
||||||
switch state {
|
switch state {
|
||||||
|
@ -558,7 +558,7 @@ func (tr *TaskRunner) SetState(state string, event *structs.TaskEvent) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return bkt.PutObject(bkt, taskStateKey, tr.state)
|
return clientstate.PutObject(bkt, taskStateKey, tr.state)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Only a warning because the next event/state-transition will
|
// Only a warning because the next event/state-transition will
|
||||||
|
@ -591,8 +591,9 @@ func (tr *TaskRunner) EmitEvent(event *structs.TaskEvent) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return bkt.PutObject(bkt, taskStateKey, tr.state)
|
return clientstate.PutObject(bkt, taskStateKey, tr.state)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Only a warning because the next event/state-transition will
|
// Only a warning because the next event/state-transition will
|
||||||
// try to persist it again.
|
// try to persist it again.
|
||||||
|
@ -625,6 +626,8 @@ func (tr *TaskRunner) emitEventImpl(event *structs.TaskEvent) error {
|
||||||
|
|
||||||
// Append event to slice
|
// Append event to slice
|
||||||
appendTaskEvent(tr.state, event)
|
appendTaskEvent(tr.state, event)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitCh is closed when TaskRunner.Run exits.
|
// WaitCh is closed when TaskRunner.Run exits.
|
||||||
|
|
Loading…
Reference in a new issue