grpc: avoid allocations for each message (#11)

* grpc: avoid allocations for each message
* fix tests for api/router

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-08-20 14:45:47 +03:00
committed by GitHub
parent 5ea2590891
commit 98ba3b2788
3 changed files with 59 additions and 30 deletions

View File

@@ -15,6 +15,8 @@ import (
"github.com/unistack-org/micro/v3/api/router"
rregistry "github.com/unistack-org/micro/v3/api/router/registry"
rstatic "github.com/unistack-org/micro/v3/api/router/static"
"github.com/unistack-org/micro/v3/broker"
bmemory "github.com/unistack-org/micro/v3/broker/memory"
"github.com/unistack-org/micro/v3/client"
gcli "github.com/unistack-org/micro/v3/client/grpc"
rmemory "github.com/unistack-org/micro/v3/registry/memory"
@@ -50,10 +52,12 @@ func (s *testServer) CallPcreInvalid(ctx context.Context, req *pb.Request, rsp *
func initial(t *testing.T) (server.Server, client.Client) {
r := rmemory.NewRegistry()
b := bmemory.NewBroker(broker.Registry(r))
// create a new client
s := gsrv.NewServer(
server.Name("foo"),
server.Broker(b),
server.Registry(r),
)
@@ -64,6 +68,7 @@ func initial(t *testing.T) (server.Server, client.Client) {
// create a new server
c := gcli.NewClient(
client.Router(rtr),
client.Broker(b),
)
h := &testServer{}