File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import (
2828func getClient (ctx * cli.Context ) types.APIClient {
2929 // reset the logger for grpc to log to dev/null so that it does not mess with our stdio
3030 grpclog .SetLogger (log .New (ioutil .Discard , "" , log .LstdFlags ))
31- dialOpts := []grpc.DialOption {grpc .WithInsecure ()}
31+ dialOpts := []grpc.DialOption {grpc .WithInsecure (), grpc . WithTimeout ( ctx . GlobalDuration ( "conn-timeout" )) }
3232 dialOpts = append (dialOpts ,
3333 grpc .WithDialer (func (addr string , timeout time.Duration ) (net.Conn , error ) {
3434 return net .DialTimeout ("unix" , addr , timeout )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
33import (
44 "fmt"
55 "os"
6+ "time"
67
78 "github.com/Sirupsen/logrus"
89 "github.com/codegangsta/cli"
@@ -43,6 +44,11 @@ func main() {
4344 Value : "/run/containerd/containerd.sock" ,
4445 Usage : "address of GRPC API" ,
4546 },
47+ cli.DurationFlag {
48+ Name : "conn-timeout" ,
49+ Value : 1 * time .Second ,
50+ Usage : "GRPC connection timeout" ,
51+ },
4652 }
4753 app .Commands = []cli.Command {
4854 checkpointCommand ,
You can’t perform that action at this time.
0 commit comments