mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Double StopContainer
request timeout.
This commit is contained in:
parent
b6211c6e79
commit
5f0288e022
@ -209,11 +209,10 @@ func (r *RemoteRuntimeService) StartContainer(containerID string) error {
|
|||||||
|
|
||||||
// StopContainer stops a running container with a grace period (i.e., timeout).
|
// StopContainer stops a running container with a grace period (i.e., timeout).
|
||||||
func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64) error {
|
func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64) error {
|
||||||
ctx, cancel := getContextWithTimeout(time.Duration(timeout) * time.Second)
|
// Use timeout + default timeout (2 minutes) as timeout to leave extra time
|
||||||
if timeout == 0 {
|
// for SIGKILL container and request latency.
|
||||||
// Use default timeout if stop timeout is 0.
|
t := r.timeout + time.Duration(timeout)*time.Second
|
||||||
ctx, cancel = getContextWithTimeout(r.timeout)
|
ctx, cancel := getContextWithTimeout(t)
|
||||||
}
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
||||||
|
Loading…
Reference in New Issue
Block a user