restart server on Init
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
e6f7ceb900
commit
2f6c352a57
11
grpc.go
11
grpc.go
@ -157,12 +157,23 @@ func (g *grpcServer) configure(opts ...server.Option) error {
|
||||
}
|
||||
|
||||
g.rsvc = nil
|
||||
restart := false
|
||||
if g.started {
|
||||
restart = true
|
||||
if err := g.Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
g.srv = grpc.NewServer(gopts...)
|
||||
|
||||
if v, ok := g.opts.Context.Value(reflectionKey{}).(bool); ok {
|
||||
g.reflection = v
|
||||
}
|
||||
|
||||
if restart {
|
||||
return g.Start()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user