-
Notifications
You must be signed in to change notification settings - Fork 9
feat: adding weighted random host selection strategy #907
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
Conversation
52a2d2f
to
78be473
Compare
78be473
to
41fda0a
Compare
docs/using-the-python-driver/using-plugins/UsingTheReadWriteSplittingPlugin.md
Outdated
Show resolved
Hide resolved
2b20e9a
to
bcbc617
Compare
5284e12
to
68180ea
Compare
68180ea
to
7e4f6d4
Compare
message = "HostSelector.NoHostsMatchingRole" | ||
logger.error(message, role) | ||
raise AwsWrapperError(Messages.get_formatted("HostSelector.NoHostsMatchingRole", role)) |
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.
message = "HostSelector.NoHostsMatchingRole" | |
logger.error(message, role) | |
raise AwsWrapperError(Messages.get_formatted("HostSelector.NoHostsMatchingRole", role)) | |
message = Messages.get_formatted("HostSelector.NoHostsMatchingRole", role) | |
logger.error(message, role) | |
raise AwsWrapperError(message) |
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.
logger.error already gets the message formatted:
def error(self, msg, *args, **kwargs):
if not self.logger.isEnabledFor(logging.ERROR):
return
if args is not None and len(args) > 0:
self.logger.error(Messages.get_formatted(msg, *args), **kwargs)
else:
try:
self.logger.error(Messages.get(msg), **kwargs)
except NotInResourceBundleError:
self.logger.error(msg, **kwargs)
logger.error(message, pair) | ||
raise AwsWrapperError(Messages.get_formatted(message, pair)) |
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.
Same comment as above
Description
Adding weighed random selection for host selection in order to prepare for future features.
User is able to add weights to different hosts to modify the likeliness of the particular host to be selected.
Manually tested for verification.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.