mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
gctcli: Add command line parameter to ignore default context timeout (#1258)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user