Invoke implements [grpc.ClientConnInterface].
(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption)
| 87 | |
| 88 | // Invoke implements [grpc.ClientConnInterface]. |
| 89 | func (conn *RPCConnection[T]) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) (err error) { |
| 90 | // Make sure, this connection is established |
| 91 | err = conn.init() |
| 92 | if err != nil { |
| 93 | return |
| 94 | } |
| 95 | |
| 96 | // Then, just forward the request to the embedded client conn |
| 97 | err = conn.cc.Invoke(ctx, method, args, reply, opts...) |
| 98 | if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) { |
| 99 | log.Debugf("Caught EOF while invoking method %s, forcing connection to reconnect on next call", method) |
| 100 | conn.ForceReconnect() |
| 101 | } |
| 102 | |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | // NewStream implements [grpc.ClientConnInterface]. |
| 107 | func (conn *RPCConnection[T]) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (stream grpc.ClientStream, err error) { |
no test coverage detected