From f0b6370ee1cbf10721269013281a417c11dd1845 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 4 Mar 2023 16:25:50 +0300 Subject: [PATCH] move codec registration to init phase Signed-off-by: Vasiliy Tolstov --- grpc.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grpc.go b/grpc.go index 130123d..da533d4 100644 --- a/grpc.go +++ b/grpc.go @@ -128,6 +128,10 @@ func (g *Server) configure(opts ...server.Option) error { } } + for _, k := range g.opts.Codecs { + encoding.RegisterCodec(&wrapMicroCodec{k}) + } + maxMsgSize := g.getMaxMsgSize() gopts := []grpc.ServerOption{ @@ -809,10 +813,6 @@ func (g *Server) Start() error { config := g.Options() - for _, k := range config.Codecs { - encoding.RegisterCodec(&wrapMicroCodec{k}) - } - // micro: config.Transport.Listen(config.Address) var ts net.Listener var err error