1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-14 02:33:03 +02:00

fix(grpc): Block the RCP unil a new picker is available (#1660)

* fix(config): Support colon as default value in config.yaml

* fix(cmd/protoc-gen-go-http): Follow the http rule to use the query string

* fix: Block the RPC until new picker is available

* fix: lints for balancer
This commit is contained in:
Giovanny Gutiérrez 2021-12-03 04:21:56 -05:00 committed by GitHub
parent 67161b62eb
commit 2471f1d955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,11 @@ type Builder struct {
// Build creates a grpc Picker.
func (b *Builder) Build(info base.PickerBuildInfo) gBalancer.Picker {
if len(info.ReadySCs) == 0 {
// Block the RPC until a new picker is available via UpdateState().
return base.NewErrPicker(gBalancer.ErrNoSubConnAvailable)
}
nodes := make([]selector.Node, 0)
for conn, info := range info.ReadySCs {
ins, _ := info.Address.Attributes.Value("rawServiceInstance").(*registry.ServiceInstance)