-
Notifications
You must be signed in to change notification settings - Fork 24
Ensuring LHM supports ActiveRecords version >= 6.1 #120
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
Ensuring LHM supports ActiveRecords version >= 6.1 #120
Conversation
0165a97 to
a49d76f
Compare
| it 'logs and creates client' do | ||
| active_record_config = {username: 'user', password: 'pw', database: 'db'} | ||
| ActiveRecord::Base.stubs(:connection_pool).returns(stub(spec: stub(config: active_record_config))) | ||
| ActiveRecord::Base.stubs(:connection_pool).returns(stub(db_config: stub(configuration_hash: active_record_config))) |
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 OK since the test environment uses ~>6.1.4
lhm.gemspec
Outdated
| s.add_development_dependency 'mocha' | ||
| s.add_development_dependency 'rake' | ||
| s.add_development_dependency 'activerecord' | ||
| s.add_development_dependency 'activerecord', '~> 6.1.4' |
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'm a bit confused. Doesn't LHM depend on an ActiveRecord connection? Why is it only a development dependency? I guess this is more a general question and not specific to this PR.
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.
Yes, it does require acrtiverecord to use. However, for development we would require 6.1.4 and greater to ensure some consistency with the development (which has been a problem in the past)
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.
Couldn't we just check in the Gemfile.lock? I'm not sure why we put it in gitignore in the first place. The commit is just saying "No gemfile.lock for gems". I checked a few other Shopify gems and they all have it checked in. 🤔
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.
At one point LHM didn't depend on AR... or at least that was the intention. Not sure if that was ever successful.
251b29a to
3e35eef
Compare
9421698 to
885a0f6
Compare
coding-chimp
left a comment
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.
👍
885a0f6 to
3cd603b
Compare
3cd603b to
f5b50a4
Compare
f5b50a4 to
b801123
Compare
de8e715 to
b0eb65d
Compare
b0eb65d to
ecf7a7a
Compare
Currently, LHM's Slave lag throttler can only be used with version of ActiveRecords that are LESS than 6.1. The problem stems from this line:
ActiveRecord::Base.connection_pool.spec.config.dupWhich was changed in version 6.1.0 to
ActiveRecord::Base.connection_pool.db_config.configuration_hash.dupIn order to not break any users downstream or induce any backwards compatibility issues, LHM should be able to differentiate between both versions and call the right function accordingly.