-
Notifications
You must be signed in to change notification settings - Fork 95
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
Added PeerManagement.Timeout config option #491
Conversation
5fb061f
to
ef32214
Compare
ef32214
to
128f0d6
Compare
128f0d6
to
3b3137e
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.
I like where this is headed -- I'll likely have more comments on the next one. But the stuff in this one is useful, so please just use AddFields and we can run with this.
internal/peer/redis.go
Outdated
if err != nil { | ||
// TODO maybe do something better here? | ||
logrus.WithField("name", p.publicAddr). |
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.
A nit, but could you please do this with logrus.WithFields rather than a succession of WithField calls?
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.
@thrawn01 -- to clarify, although I approved this PR, I would like to see that change before we merge it. Are you able to do that, please?
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.
Done.
@@ -1,3 +1,4 @@ | |||
//go:build all || race |
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.
We're on 1.18+, so this is a good change. Thank you.
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.
As per @kentquirk's request, please can you update your logs to use WithFields 👍🏻
This will also need a rebase to resolve conflicts. |
Done. |
@Baliedge please could you update the log to use WithFields as @kentquirk suggestion too? |
Also done. |
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.
Co-authored-by: Shawn Poulson <[email protected]>
Which problem is this PR solving?
This PR adds a new config option called
PeerManagement.Timeout
which will be used when communicating with peer discovery systems implementing thePeers
interface. This PR also add support forcontext.Context
when first connecting to thePeers
implementation.Short description of the changes
NewPeers()
now accepts acontext.Context
NewPeers()
initialization after logging setup to take advantage of logs during any initial connect attempts.//go:build all || race
which is the new 1.18+ format for build tags (I can revert if not needed, my IDE auto fixed it 😄 )Router
where thecancel()
function is never called.Note
I'm noting here that
context.Context
passed toNewPeer()
is not as useful to redis because the redis dial function already has a retry and timeout loop. However, it will be useful for other concrete implementations of thePeers
interface. If this PR is accepted, I wish to follow up with a PR that uses https://github.com/hashicorp/memberlist for peer discovery.