A nil context isn't an error

This commit is contained in:
Michael Schurter 2016-09-02 15:41:41 -07:00
parent f601361d58
commit 8a57913a44
1 changed files with 7 additions and 9 deletions

View File

@ -51,13 +51,14 @@ type AllocRunner struct {
dirtyCh chan struct{} dirtyCh chan struct{}
ctx *driver.ExecContext ctx *driver.ExecContext
ctxLock sync.Mutex ctxLock sync.Mutex
tasks map[string]*TaskRunner
taskStates map[string]*structs.TaskState
restored map[string]struct{}
taskLock sync.RWMutex
tasks map[string]*TaskRunner
restored map[string]struct{}
taskLock sync.RWMutex
taskStates map[string]*structs.TaskState
taskStatusLock sync.RWMutex taskStatusLock sync.RWMutex
updateCh chan *structs.Allocation updateCh chan *structs.Allocation
@ -126,9 +127,6 @@ func (r *AllocRunner) RestoreState() error {
if r.alloc == nil { if r.alloc == nil {
snapshotErrors.Errors = append(snapshotErrors.Errors, fmt.Errorf("alloc_runner snapshot includes a nil allocation")) snapshotErrors.Errors = append(snapshotErrors.Errors, fmt.Errorf("alloc_runner snapshot includes a nil allocation"))
} }
if r.ctx == nil {
snapshotErrors.Errors = append(snapshotErrors.Errors, fmt.Errorf("alloc_runner snapshot includes a nil context"))
}
if e := snapshotErrors.ErrorOrNil(); e != nil { if e := snapshotErrors.ErrorOrNil(); e != nil {
return e return e
} }