all the refactor
This commit is contained in:
@@ -284,9 +284,14 @@ func NewControlServer[V any](config ServerConfig, pool GrainPool[V]) (*grpc.Serv
|
||||
reflection.Register(grpcServer)
|
||||
|
||||
log.Printf("gRPC server listening as %s on %s", pool.Hostname(), config.Addr)
|
||||
// Serve runs in a goroutine because it blocks until the listener is closed.
|
||||
// On Serve error we log it instead of crashing the whole process from deep
|
||||
// inside this package — the caller (composition root) should rely on
|
||||
// process supervision (Kubernetes) to restart, or check gRPC health via the
|
||||
// pool after this returns.
|
||||
go func() {
|
||||
if err := grpcServer.Serve(lis); err != nil {
|
||||
log.Fatalf("failed to serve gRPC: %v", err)
|
||||
log.Printf("gRPC server %s serve error: %v", config.Addr, err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user