improve code quality
This commit is contained in:
parent
88d56e653d
commit
1e0ca25db0
4
grpc.go
4
grpc.go
@ -339,7 +339,9 @@ func (g *grpcClient) Call(ctx context.Context, req client.Request, rsp interface
|
|||||||
d, ok := ctx.Deadline()
|
d, ok := ctx.Deadline()
|
||||||
if !ok {
|
if !ok {
|
||||||
// no deadline so we create a new one
|
// no deadline so we create a new one
|
||||||
ctx, _ = context.WithTimeout(ctx, callOpts.RequestTimeout)
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithTimeout(ctx, callOpts.RequestTimeout)
|
||||||
|
defer cancel()
|
||||||
} else {
|
} else {
|
||||||
// got a deadline so no need to setup context
|
// got a deadline so no need to setup context
|
||||||
// but we need to set the timeout we pass along
|
// but we need to set the timeout we pass along
|
||||||
|
Loading…
Reference in New Issue
Block a user