73
return err
74
}
76
}
77
78
>
func (r *BasicRedirector[C]) redirectLoop(ctx context.Context, address rpcAddress, op ClientOperation[C]) error {
redirector.go
79
>
for {
80
>
if err := common.IsValidContext(ctx); err != nil {
81
return err
82
}
83
>
clientConn := r.connections.getOrCreateClientConn(address)
redirector.go
84
>
err := op(ctx, clientConn.grpcClient)
85
>
var solErr *serviceerrors.ShardOwnershipLost
86
>
if !errors.As(err, &solErr) || len(solErr.OwnerHost) == 0 {
87
>
return err
88
>
}
89
// TODO: consider emitting a metric for number of redirects
90
address = rpcAddress(solErr.OwnerHost)