From b835a6ff1992c03c96ba429a322c9f0b565b5032 Mon Sep 17 00:00:00 2001 From: Abel Feng Date: Tue, 5 Nov 2024 14:38:41 +0800 Subject: [PATCH] reduce the delete delay currently in the `killContainer`, after send SigKill, we have to wait at least 100ms and then check if the process exit. it is a little bit long, especially for those pod with many containers in, when `crictl rmp -f` the pod, the delay may even exceed 1s. Signed-off-by: Abel Feng --- delete.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/delete.go b/delete.go index fc8133438ea..b28e9ea5bb7 100644 --- a/delete.go +++ b/delete.go @@ -15,8 +15,8 @@ import ( func killContainer(container *libcontainer.Container) error { _ = container.Signal(unix.SIGKILL) - for i := 0; i < 100; i++ { - time.Sleep(100 * time.Millisecond) + for i := 0; i < 12; i++ { + time.Sleep((1 << i) * time.Millisecond) if err := container.Signal(unix.Signal(0)); err != nil { return container.Destroy() }