-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix possible problems with ClusterClient Discovery #7270
Fix possible problems with ClusterClient Discovery #7270
Conversation
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 some general comments
@@ -49,6 +50,7 @@ private sealed record ResolveResult(Contact Contact, IActorRef? Subject); | |||
private readonly string _targetActorSystemName; | |||
private readonly string _receptionistName; | |||
private readonly string _transportProtocol; | |||
private readonly int _numberOfContacts; |
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 just the number of initial contacts we need, right?
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.
it limits the number of contacts we use when we instantiate the ClusterClient actor. Too many of these will set the initial contacts to a higher than optimum number. The thing is that ClusterClient initial contacts never gets trimmed when they can't be contacted, if we use the whole discovery resolve result as the ClusterClient initial contact list, there will be a big burst of network connection attempt when the ClusterClient actor starts up and whenever its internal contact list could not be contacted anymore.
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.
Got it, makes sense
/// </summary> | ||
/// <param name="array"></param> | ||
/// <typeparam name="T"></typeparam> | ||
private static void Shuffle<T>(T[] array) |
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.
Do we have another implementation of this lying around somewhere? I could have sworn I'd written one before
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 idea
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.
There is one in the Akka.Util.Internal.ArrayExtensions, but its internal
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 would add a link to that file and just use that (or you can add a friend assembly to Akka.Discovery; link is probably cleaner.)
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.
That's just a nitpick though
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, turns out the core Akka project is already a friend of Akka.Cluster.Tools
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.
LGTM
Changes