We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于grpc超时控制,grpc client可以通过拦截器设置超时,grpc server如何在调用超时时结束当前流程,尝试通过如下形式实现,但是也不能保证超时后服务端立即结束当前调用 data := make(chan *pb.SimpleResponse, 1) go handle(ctx, req, data) select { case res := <-data: return res, nil case <-ctx.Done(): return nil, status.Errorf(codes.Canceled, "Client cancelled, abandoning.") } 上述程序执行后,即使超时了go handle(ctx, req, data)里面的逻辑也会全部执行完才会退出吧?请问下有更优雅地实现方式吗?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
关于grpc超时控制,grpc client可以通过拦截器设置超时,grpc server如何在调用超时时结束当前流程,尝试通过如下形式实现,但是也不能保证超时后服务端立即结束当前调用
data := make(chan *pb.SimpleResponse, 1)
go handle(ctx, req, data)
select {
case res := <-data:
return res, nil
case <-ctx.Done():
return nil, status.Errorf(codes.Canceled, "Client cancelled, abandoning.")
}
上述程序执行后,即使超时了go handle(ctx, req, data)里面的逻辑也会全部执行完才会退出吧?请问下有更优雅地实现方式吗?
The text was updated successfully, but these errors were encountered: