Actually, you don't need to do either of those. When the client loses the connection, it will automatically attempts to reconnect. Status code 14 is the UNAVAILABLE status ( https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/status.h#L144), which is transient. When you get that error, you should just retry the call with the same client (assuming that the server logic can handle retries).
On Thu, Jun 9, 2016 at 6:53 AM <[email protected]> wrote: > > I am using gRPC with ruby on both client and server side. I was managing > the client connection in this way: > > 1. Create the connection once when application starts -> > @SEARCH_CLIENT = Search::HouseSearchService::Stub.new('localhost:50052', > :this_channel_is_insecure) > > 2. Use the client instance to make gRPC calls during runtime. > > @SEARCH_CLIENT.search(request) > > > The problem that I am facing in this scheme is that whenever I restart my > service, the gRPC call returns a GRPC BadStatus 14 > > > Is it okay to create the connection and make the call together everytime > during runtime for each call? Or should I just put some error handling myself > to re-connect in case I get an error? > > > > -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/b01383bd-030d-4ea9-a4f3-990203a5e07f%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/b01383bd-030d-4ea9-a4f3-990203a5e07f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAPK2-4c3aezKsDXJ0kV0FrGQyesFMCN5hK5fLE_kd8RzYLdvEA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
