Update grpc timeout and logger
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
gocontext "context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
golog "log"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -50,7 +49,7 @@ high performance container runtime
|
||||
|
||||
func init() {
|
||||
// Discard grpc logs so that they don't mess with our stdio
|
||||
grpclog.SetLogger(golog.New(ioutil.Discard, "", golog.LstdFlags))
|
||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
|
||||
|
||||
cli.VersionPrinter = func(c *cli.Context) {
|
||||
fmt.Println(c.App.Name, version.Package, c.App.Version, version.Revision)
|
||||
|
||||
@@ -95,12 +95,13 @@ func connect(address string, d func(string, time.Duration) (net.Conn, error)) (*
|
||||
gopts := []grpc.DialOption{
|
||||
grpc.WithBlock(),
|
||||
grpc.WithInsecure(),
|
||||
grpc.WithTimeout(60 * time.Second),
|
||||
grpc.WithDialer(d),
|
||||
grpc.FailOnNonTempDialError(true),
|
||||
grpc.WithBackoffMaxDelay(3 * time.Second),
|
||||
}
|
||||
conn, err := grpc.Dial(dialer.DialAddress(address), gopts...)
|
||||
ctx, cancel := gocontext.WithTimeout(gocontext.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
conn, err := grpc.DialContext(ctx, dialer.DialAddress(address), gopts...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to dial %q", address)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user