Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout fixes #668

Merged
merged 2 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ var createContainerCommand = &cli.Command{
Usage: "Create a new container",
ArgsUsage: "POD container-config.[json|yaml] pod-config.[json|yaml]",
Flags: append(createPullFlags, &cli.DurationFlag{
Name: "timeout",
Aliases: []string{"t"},
Name: "cancel-timeout",
Aliases: []string{"T"},
Value: 0,
Usage: "Seconds to wait for a container create request before cancelling the request",
Usage: "Seconds to wait for a container create request to complete before cancelling the request",
}),

Action: func(context *cli.Context) error {
Expand Down Expand Up @@ -167,7 +167,7 @@ var createContainerCommand = &cli.Command{
creds: context.String("creds"),
auth: context.String("auth"),
},
timeout: context.Duration("timeout"),
timeout: context.Duration("cancel-timeout"),
},
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/crictl/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ var runPodCommand = &cli.Command{
Usage: "Runtime handler to use. Available options are defined by the container runtime.",
},
&cli.DurationFlag{
Name: "timeout",
Aliases: []string{"t"},
Name: "cancel-timeout",
Aliases: []string{"T"},
Value: 0,
Usage: "Seconds to wait for a run pod sandox request to complete before cancelling the request",
Usage: "Seconds to wait for a run pod sandbox request to complete before cancelling the request",
},
},

Expand All @@ -78,7 +78,7 @@ var runPodCommand = &cli.Command{
}

// Test RuntimeServiceClient.RunPodSandbox
podID, err := RunPodSandbox(runtimeClient, podSandboxConfig, context.String("runtime"), context.Duration("timeout"))
podID, err := RunPodSandbox(runtimeClient, podSandboxConfig, context.String("runtime"), context.Duration("cancel-timeout"))
if err != nil {
return errors.Wrap(err, "run pod sandbox")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/crictl/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func ctxWithTimeout(timeout time.Duration) context.Context {
ctx, cancel := context.WithCancel(context.Background())
if timeout > 0 {
go func() {
time.Sleep(timeout * time.Second)
time.Sleep(timeout)
cancel()
}()
}
Expand Down