How can I set the mysql query timeout in ActiveRecord? I wish to set it to something very short, like 10-15ms. This is for a Sinatra ruby web app.
Thanks.
How can I set the mysql query timeout in ActiveRecord? I wish to set it to something very short, like 10-15ms. This is for a Sinatra ruby web app.
Thanks.
Well, it would appear that per these lines 29 and 30 in mysql_adapter.rb,
One need simply only add a read_timeout and write_timeout value to the .yaml database config file.
Thus,
Should do the trick to set read and write timeouts of 1 sec apiece. Unfortunately this does not allow you to set sub-second timeouts.
You could also set it in a per-connection basis like this:
I'm doing this for instance to have a default read_timeout, but override it for my long-running nightly scripts.