fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.96k stars 508 forks source link

Emulate cURL CLI flags: --retry N --retry-all-errors #371

Open andresvia opened 1 year ago

andresvia commented 1 year ago

Feature request for your consideration.

curl does not retry by default, but it can be instructed to do so with the command line flags --retry and --retry-all-errors, maybe grpcurl should do the same or something similar.

Background: I'm doing a docker run --detach --name MyApp MyApp

Followed by a docker run --network container:MyApp fullstorydev/grpcurl 127.0.0.1:50051 MyService/MyRPC, but I get something like Failed to dial target host "127.0.0.1:50051": dial tcp 127.0.0.1:50051: connect: connection refused because nor the container or the app can come up as fast as the next command/script/etc.

Rather than adding an extra step to "wait for MYAPP to be ready" I rather just slap a command line flag to grpcurl

disclaimer:

Thanks!

jhump commented 1 year ago

This probably calls for the same sort of solution as added to grpcui in https://github.com/fullstorydev/grpcui/pull/133.

There's even a comment on that PR (and a TODO in the code) that it's likely appropriate to port that logic into a new dial function in the grpcurl package, which would also make it trivial to wire up a new command-line flag here to use it.

cc @dragonsinth

dragonsinth commented 1 year ago

Yes... if timing out the dial instead of failing fast fixes this case, that seems pretty ideal.