mirror of https://github.com/k3s-io/k3s
Merge pull request #46267 from Random-Liu/extend-stop-container-request-timeout
Automatic merge from submit-queue Double `StopContainer` request timeout. Doubled `StopContainer` request timeout to leave some time for `SIGKILL` container. @yujuhong @feiskyerpull/6/head
commit
98c66f9fca
|
@ -209,11 +209,10 @@ func (r *RemoteRuntimeService) StartContainer(containerID string) error {
|
|||
|
||||
// StopContainer stops a running container with a grace period (i.e., timeout).
|
||||
func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64) error {
|
||||
ctx, cancel := getContextWithTimeout(time.Duration(timeout) * time.Second)
|
||||
if timeout == 0 {
|
||||
// Use default timeout if stop timeout is 0.
|
||||
ctx, cancel = getContextWithTimeout(r.timeout)
|
||||
}
|
||||
// Use timeout + default timeout (2 minutes) as timeout to leave extra time
|
||||
// for SIGKILL container and request latency.
|
||||
t := r.timeout + time.Duration(timeout)*time.Second
|
||||
ctx, cancel := getContextWithTimeout(t)
|
||||
defer cancel()
|
||||
|
||||
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
||||
|
|
Loading…
Reference in New Issue