Skip to content

Improvements on the runtime rpc server #11376

@jvillafanez

Description

@jvillafanez

Is your feature request related to a problem? Please describe.

The runtime rpc server is setup accordingly to the example shown in the documentation. However, it uses methods targeting a default server, so the setup isn't clear. Since the default server is mostly hidden, from the outside it seems random functions doing things without a clear connection among each other.

Describe the solution you'd like

A more explicit setup.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Target code is in

func (s *Service) runRPCServer() {
if err := rpc.Register(s); err != nil {
if s != nil {
s.Log.Fatal().Err(err).Msg("could not register rpc service")
return
}
}
rpc.HandleHTTP()
// run rpc server
srv := new(http.Server)
go func() {
l, err := net.Listen("tcp", net.JoinHostPort(s.cfg.Runtime.Host, s.cfg.Runtime.Port))
if err != nil {
s.Log.Fatal().Err(err).Msg("could not start listener")
return
}
if err = srv.Serve(l); err != nil && !errors.Is(err, http.ErrServerClosed) {
s.Log.Fatal().Err(err).Msg("could not start rpc server")
}
}()
}

There are some methods to configure rpc and a server listening in a "random" port, but no clear connection between the two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions