Instead of the timeout happening in the client using max_stream_lifetime the timeout is moved to the server.
1.) The timeout in the server is max_connection_age - 2s, because sufficiently small grace period could cause gRPC to interrupt the connection before the server is able to send a signal to the client to close the stream. So I am subtracting a couple seconds to give the server extra time to send the shutdown signal to the client, otherwise shutdown may be ungraceful.
2.) The client could potentially get two signals from the server, an error and end_of_lifetime signal. This might take a couple of iterations for client.stream.write to process both signals, but both should eventually be processed. This can be seen in the added unit tests where an extra call to SendAndWait is needed to see the error for stream restart.
This PR is a followup to https://github.com/f5/otel-arrow-adapter/pull/207
Instead of the timeout happening in the client using
max_stream_lifetime
the timeout is moved to the server.1.) The timeout in the server is
max_connection_age - 2s
, because sufficiently small grace period could cause gRPC to interrupt the connection before the server is able to send a signal to the client to close the stream. So I am subtracting a couple seconds to give the server extra time to send the shutdown signal to the client, otherwise shutdown may be ungraceful.2.) The client could potentially get two signals from the server, an
error
andend_of_lifetime
signal. This might take a couple of iterations forclient.stream.write
to process both signals, but both should eventually be processed. This can be seen in the added unit tests where an extra call toSendAndWait
is needed to see the error for stream restart.