From 7671a453f09f7fbd522492e5f4065d8de5411a60 Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 10 Jul 2023 11:18:02 +1000 Subject: [PATCH] gctcli: Add command line parameter to ignore default context timeout (#1258) --- cmd/gctcli/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/gctcli/main.go b/cmd/gctcli/main.go index 288fd87c..c9b3b12e 100644 --- a/cmd/gctcli/main.go +++ b/cmd/gctcli/main.go @@ -30,6 +30,7 @@ var ( timeout time.Duration exchangeCreds account.Credentials verbose bool + ignoreTimeout bool ) const defaultTimeout = time.Second * 30 @@ -56,7 +57,9 @@ func setupClient(c *cli.Context) (*grpc.ClientConn, context.CancelFunc, error) { } var cancel context.CancelFunc - c.Context, cancel = context.WithTimeout(c.Context, timeout) + if !ignoreTimeout { + c.Context, cancel = context.WithTimeout(c.Context, timeout) + } if !exchangeCreds.IsEmpty() { flag, values := exchangeCreds.GetMetaData() c.Context = metadata.AppendToOutgoingContext(c.Context, flag, values) @@ -146,6 +149,12 @@ func main() { Usage: "allows the request to generate a more verbose outputs server side", Destination: &verbose, }, + &cli.BoolFlag{ + Name: "ignoretimeout", + Aliases: []string{"it"}, + Usage: "ignores the context timeout for requests", + Destination: &ignoreTimeout, + }, } app.Commands = []*cli.Command{ getInfoCommand,