Merge pull request #586 from stevvooe/dist-grpc-connect
cmd/dist: add global connect-timeout for GRPC
This commit is contained in:
commit
4793f968e5
3 changed files with 9 additions and 4 deletions
2
cmd/dist/common.go
vendored
2
cmd/dist/common.go
vendored
|
@ -24,7 +24,9 @@ func resolveContentStore(context *cli.Context) (*content.Store, error) {
|
|||
|
||||
func connectGRPC(context *cli.Context) (*grpc.ClientConn, error) {
|
||||
socket := context.GlobalString("socket")
|
||||
timeout := context.GlobalDuration("connect-timeout")
|
||||
return grpc.Dial(socket,
|
||||
grpc.WithTimeout(timeout),
|
||||
grpc.WithBlock(),
|
||||
grpc.WithInsecure(),
|
||||
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
||||
|
|
2
cmd/dist/fetch.go
vendored
2
cmd/dist/fetch.go
vendored
|
@ -39,7 +39,7 @@ var fetchCommand = cli.Command{
|
|||
},
|
||||
Action: func(context *cli.Context) error {
|
||||
var (
|
||||
ctx = contextpkg.Background()
|
||||
ctx = background
|
||||
timeout = context.Duration("timeout")
|
||||
locator = context.Args().First()
|
||||
args = context.Args().Tail()
|
||||
|
|
7
cmd/dist/main.go
vendored
7
cmd/dist/main.go
vendored
|
@ -41,8 +41,11 @@ distribution tool
|
|||
},
|
||||
cli.DurationFlag{
|
||||
Name: "timeout",
|
||||
Usage: "total timeout for fetch",
|
||||
EnvVar: "CONTAINERD_FETCH_TIMEOUT",
|
||||
Usage: "total timeout for dist commands",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "connect-timeout",
|
||||
Usage: "timeout for connecting to containerd",
|
||||
},
|
||||
cli.StringFlag{
|
||||
// TODO(stevvooe): for now, we allow circumventing the GRPC. Once
|
||||
|
|
Loading…
Reference in a new issue