-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Cast query_cache
value when using URL configuration
#53491
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
case value = configuration_hash[:query_cache] | ||
when /\A\d+\z/ | ||
value.to_i | ||
when "false" | ||
false | ||
else | ||
value | ||
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 think this should be in the subclass, UrlConfig
, as it doesn't make sense to do casting when provided a hash from Ruby.
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.
Whoops, yeah forgot we talked about this. Fixed in 6302519.
c26781d
to
6302519
Compare
@@ -57,6 +57,17 @@ def initialize(env_name, name, url, configuration_hash = {}) | |||
@configuration_hash.freeze | |||
end | |||
|
|||
def query_cache # :nodoc: | |||
case value = configuration_hash[:query_cache] |
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 think we might want to do this in initialize
so that we don't redo it on every access.
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.
Ok, I didn't realize that was already happening for "false"
. Added 15606ec.
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.
Whoops fixed tests in af9b0f2
6302519
to
15606ec
Compare
15606ec
to
af9b0f2
Compare
When using
DATABASE_URL
, you cannot adjust the max size of the query_cache using the parameter. Since it remains as the string"42"
it will result in not setting a max size:rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
Lines 122 to 129 in 1869a5a
cc @byroot