-
Notifications
You must be signed in to change notification settings - Fork 177
Description
I was tracking down a seemingly slow call, and found that the call.request(1) for the initial stream happened lazily in grpc-kotlin compared to where it happens in the observer version. I have The PR here
In short, this moves the call.request(1) to the startCall part instead of in the flow. This probably has negligible impact for small messages, as I'm unsure how much buffer the grpcServer has. It seemed to make a slight difference in our prod code path.
The main reason is it was a curve ball for us. There was a discrepancy between the unary calls and the streaming calls in the amount of time the method was running, since the streaming rpc calls suspend on the request.collect() call.
It would be even nicer to pre-hydrate the first request on the flow if possible, so that the rpc implementation method isn't called till at least one object in the flow is ready, but that would be much more complex I believe.