improve code quality
This commit is contained in:
		
							
								
								
									
										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 | ||||
| 	if len(to) > 0 { | ||||
| 		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() | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user