runtime/v2: Fix defer cleanup
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
This commit is contained in:
parent
6b410ba41f
commit
30e1e66e5c
@ -24,6 +24,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containerd/containerd/containers"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/events/exchange"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/metadata"
|
||||
@ -155,6 +156,10 @@ func (m *TaskManager) Create(ctx context.Context, id string, opts runtime.Create
|
||||
defer cancel()
|
||||
_, errShim := shim.Delete(dctx)
|
||||
if errShim != nil {
|
||||
if errdefs.IsDeadlineExceeded(errShim) {
|
||||
dctx, cancel = timeout.WithContext(context.Background(), cleanupTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
shim.Shutdown(dctx)
|
||||
shim.Close()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user