Skip to content

Commit

Permalink
reduce the delete delay
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
abel-von committed Nov 5, 2024
1 parent d6e6e7b commit b835a6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit b835a6f

Please sign in to comment.