Merge pull request #2151 from Random-Liu/fix-load-task

Fix task load.
This commit is contained in:
Michael Crosby 2018-02-27 11:10:45 -05:00 committed by GitHub
commit 25c403415a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,7 +283,6 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
if t.io != nil {
t.io.Cancel()
t.io.Wait()
t.io.Close()
}
r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{
ContainerID: t.id,
@ -291,6 +290,10 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
if err != nil {
return nil, errdefs.FromGRPC(err)
}
// Only cleanup the IO after a successful Delete
if t.io != nil {
t.io.Close()
}
return &ExitStatus{code: r.ExitStatus, exitedAt: r.ExitedAt}, nil
}