-
Notifications
You must be signed in to change notification settings - Fork 170
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
Deprecate 'master' in favor of 'primary' #290
Conversation
11212cd
to
d3c5775
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.
Had a couple of questions about some of the changes that appear to either be changing the behavior or don't visibly make sense. If you have good reasons I'm happy to approve.
@makara_config[:connections].map do |connection| | ||
base_config.merge(makara_config.except(:connections)) | ||
.merge(connection.symbolize_keys) | ||
@all_configs ||= @makara_config[:connections].map do |connection| |
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 seems like a behavior change. Now we won't be re-calculating all_configs each time it is called. That may ultimately be desired behavior but wanted to call out that potentially this could break things
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.
AFAIK these are immutable structures anyway (since they're just loaded from config files)
# do these args require a master connection | ||
def needs_master?(method_name, args) | ||
true | ||
# Do these args require a primary connection | ||
def needs_primary?(method_name, args) | ||
if respond_to?(:needs_master?) | ||
warn "#{self.class}#needs_master? is deprecated. Switch to #needs_primary?" | ||
needs_master?(method_name, args) | ||
else | ||
true | ||
end |
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 don't fully understand this change. How could it respond_to needs_master?
since your removed that method? It also seems like it would be throwing a deprecation warning potentially when using the correct method. I'm sure there is some method magic happening that I just don't see but wanted to call it out.
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.
My understanding is this method is meant to be overwritten in subclasses by users. So if someone has defined their own needs_master?
, we should still call it but emit this warning that they should rename the method.
Also deprecates the use of the
slave
role (although this doesn't actually matter since we just assume anything butprimary
is a replica).