Skip to content
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

No way to specify wait_timeout via DATABASE_URL for mysql2 #26556

Closed
defsprite opened this issue Sep 20, 2016 · 0 comments
Closed

No way to specify wait_timeout via DATABASE_URL for mysql2 #26556

defsprite opened this issue Sep 20, 2016 · 0 comments

Comments

@defsprite
Copy link

defsprite commented Sep 20, 2016

Steps to reproduce

Using the mysql2 gem, open a console with DATABASE_URL using wait_timeout configuration, e.g.:

DATABASE_URL="mysql2://localhost:3306/test-db?wait_timeout=60&checkout_timeout=42" bundle exec rails console

pry(main)> ActiveRecord::Base.connection.execute("SHOW VARIABLES LIKE \"wait_timeout\"").to_a
=> [["wait_timeout", "2147483"]]

I believe the culprit is the Integer/Fixnum check here, which was introduced as some sort of backwards compatibility, because wait_timeout was also used by the connection pool configuration.

There is no way to get the parameter typed as Integer when using a DATABASE_URL, which seems like undesirable behaviour from my point of view.

Expected behavior

The configured wait_timeout should be 60 all connections.

Actual behavior

The configured wait_timeout is the default of 2147483 on all connections.

System configuration

Rails version:
Tested with ActiveRecord 4.2.7.1, possibly more versions affected.

Ruby version:
Tested with ruby 2.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants