VOL-2658 - increase the default timeout
increase the default timeout for GRPC calls from 10s to 5m and also add
a command line option to set the timeout as opposed to just being able
to set it via the config file.
Change-Id: I36621255018fd36b99bacb73bfada8c7abe02594
diff --git a/VERSION b/VERSION
index 3bc1715..bb83058 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.11-dev
+1.0.12
diff --git a/internal/pkg/commands/command.go b/internal/pkg/commands/command.go
index d839907..1cae97b 100644
--- a/internal/pkg/commands/command.go
+++ b/internal/pkg/commands/command.go
@@ -84,7 +84,7 @@
UseTls: false,
},
Grpc: GrpcConfigSpec{
- Timeout: time.Second * 10,
+ Timeout: time.Minute * 5,
},
}
@@ -98,6 +98,7 @@
// nolint: staticcheck
ApiVersion string `short:"a" long:"apiversion" description:"API version" value-name:"VERSION" choice:"v1" choice:"v2" choice:"v3"`
Debug bool `short:"d" long:"debug" description:"Enable debug mode"`
+ Timeout string `short:"t" long:"timeout" description:"API call timeout duration" value-name:"DURATION" default:""`
UseTLS bool `long:"tls" description:"Use TLS"`
CACert string `long:"tlscacert" value-name:"CA_CERT_FILE" description:"Trust certs signed only by this CA"`
Cert string `long:"tlscert" value-name:"CERT_FILE" description:"Path to TLS vertificate file"`
@@ -205,6 +206,15 @@
GlobalConfig.ApiVersion = GlobalOptions.ApiVersion
}
+ if GlobalOptions.Timeout != "" {
+ timeout, err := time.ParseDuration(GlobalOptions.Timeout)
+ if err != nil {
+ Error.Fatalf("Unable to parse specified timeout duration '%s': %s",
+ GlobalOptions.Timeout, err.Error())
+ }
+ GlobalConfig.Grpc.Timeout = timeout
+ }
+
// If a k8s cert/key were not specified, then attempt to read it from
// any $HOME/.kube/config if it exists
if len(GlobalOptions.K8sConfig) == 0 {