-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add multi beacon client support #876
Add multi beacon client support #876
Conversation
Lint fixes
Set beacon handler for the default beacon process
Fix loading beacon process
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.
I want to let @willscott have a pass now
client/grpc/client.go
Outdated
@@ -7,6 +7,8 @@ import ( | |||
"fmt" | |||
"time" | |||
|
|||
"github.com/drand/drand/protobuf/common" |
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.
why is this in a separate import block and not next to protobuf/drand
below?
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.
Fixed
@@ -6,12 +6,14 @@ import ( | |||
"fmt" | |||
"sync" | |||
|
|||
"github.com/drand/drand/chain" |
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.
why is this in a new block?
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.
Fixed
go.mod
Outdated
@@ -58,26 +57,31 @@ require ( | |||
google.golang.org/protobuf v1.27.1 | |||
) | |||
|
|||
require ( |
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 it really canonical in golang 1.17 to have 3 require blocks?
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... I've unified all the packages under one require block
} | ||
|
||
mux := http.NewServeMux() | ||
//TODO: aggregated bulk round responses. | ||
mux := chi.NewMux() |
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.
what are you getting out of chi mux versus the stdlib one?
you're not refactoring the routes to idiomatic chi (mux.With(commonHeaders).Get('/health', handler.Health)
.
The templating of the chainHashParamKey
below feels suspect.
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 main advantage that we make use in chi
is the param extract util with chi.URLParam(r, chainHashParamKey)
.
Since it's compatible with stdlib, we saw no need to change the already established routes.
I can change them to be chi idiomatic as you wrote if that is the case.
http/server.go
Outdated
chainHashStr = common.DefaultChainHash | ||
} | ||
|
||
h.state.Lock() |
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.
This is going to get called on every inbound http client request.
This structure is going to have lock contention.
It at least needs to be an RWMutex
because you are only Rlock
ing it here, not needing to acquire an exclusive lock.
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.
ok, fixed it
try running |
i see:
Is this an indication of some edge case where it's possible for multiple beacons to potentially collide? |
No description provided.