-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce rpc.Params #4517
Introduce rpc.Params #4517
Conversation
@@ -82,9 +82,6 @@ func startHandler(c *cli.Context) { | |||
sigc := make(chan os.Signal, 1) | |||
signal.Notify(sigc, syscall.SIGTERM) | |||
for _, svc := range services { | |||
if _, ok := cfg.Services[svc]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to check here. This is checked down the line in server.startService
when config is actually needed.
@@ -70,9 +70,6 @@ func newServer(service string, cfg *config.Config) common.Daemon { | |||
|
|||
// Start starts the server | |||
func (s *server) Start() { | |||
if _, ok := s.cfg.Services[s.name]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to check here. This is checked down the line in server.startService
when config is actually needed.
8e5a011
to
dbbe77f
Compare
dbbe77f
to
5df06df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left one minor comment
common/rpc/grpc.go
Outdated
type ( | ||
GRPCPortResolver interface { | ||
GetGRPCAddress(service, hostAddress string) (string, error) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this interface really needed?
If so, I would make it more general, as it does nothing specific to grpc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface is needed, as integration tests pass different implementation.
But I agree that the name could be more general. Updated it.
What changed?
Introduced
rpc.Params
structure that contains required parameters to initializerpc.Factory
.This decouples Factory from using config directly. It is beneficial for 2 reasons:
rpc.Factory
in integration tests. Before we had a separate implementation there, with minor differences. Now we can pass those differences via Params.Also refactored service config retrieval into a function. This is now used in couple of places.
Why?
To reduce code duplication and increase test coverage.
How did you test it?
Additional unit tests for refactored code.
Existing tests.
Starting server locally with removed config section.
Potential risks
Release notes
Documentation Changes