improve code quality
This commit is contained in:
parent
4cba1b3ec9
commit
e13e329abc
4
grpc.go
4
grpc.go
@ -222,7 +222,9 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) error {
|
|||||||
// set the timeout if we have it
|
// set the timeout if we have it
|
||||||
if len(to) > 0 {
|
if len(to) > 0 {
|
||||||
if n, err := strconv.ParseUint(to, 10, 64); err == nil {
|
if n, err := strconv.ParseUint(to, 10, 64); err == nil {
|
||||||
ctx, _ = context.WithTimeout(ctx, time.Duration(n))
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithTimeout(ctx, time.Duration(n))
|
||||||
|
defer cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user