Skip to content

Commit

Permalink
fix tcp server exit (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
wk989898 authored Dec 23, 2024
1 parent 55f0548 commit 9e57860
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ func (c *server) initialize(ctx context.Context) error {
for _, subModule := range c.subModules {
appctx.SetService(subModule.Name(), subModule)
}
// start tcp server
go func() {
err := c.tcpServer.Run(ctx)
if err != nil {
log.Error("tcp server exist", zap.Error(cerror.Trace(err)))
}
}()
log.Info("server initialized", zap.Any("server", c.info))
return nil
}
Expand All @@ -170,10 +177,6 @@ func (c *server) Run(ctx context.Context) error {
}()

g, ctx := errgroup.WithContext(ctx)
// start tcp server
g.Go(func() error {
return c.tcpServer.Run(ctx)
})
// start all submodules
for _, sub := range c.subModules {
func(m common.SubModule) {
Expand Down

0 comments on commit 9e57860

Please sign in to comment.