in azkustodata/kusto.go [248:271]
func CalculateTimeout(ctx context.Context, opt *queryOptions, queryType int) {
// If the user has specified a timeout, use that.
if val, ok := opt.requestProperties.Options[NoRequestTimeoutValue]; ok && val.(bool) {
return
}
if _, ok := opt.requestProperties.Options[ServerTimeoutValue]; ok {
return
}
// Otherwise use the context deadline, if it exists. If it doesn't, use the default timeout.
if deadline, ok := ctx.Deadline(); ok {
opt.requestProperties.Options[ServerTimeoutValue] = value.TimespanString(deadline.Sub(nower()))
return
}
var timeout time.Duration
switch queryType {
case queryCall:
timeout = defaultQueryTimeout
case mgmtCall:
timeout = defaultMgmtTimeout
}
opt.requestProperties.Options[ServerTimeoutValue] = value.TimespanString(timeout)
}