What units is timeout in Rails database.yml? What units is timeout in Rails database.yml? database database

What units is timeout in Rails database.yml?


the timeout is in milliseconds. This is the entire time which rails app wait for database response. Good practice is to add reconnect option in this file then the application will try reconnecting to the server before giving up in case of a lost connection.


Number of seconds to block and wait for a connection before giving up and raising a timeout error (default 5 seconds).

wait_timeout: 900 # 15 minutes.timeout: 5000 # 5 seconds.

MYSQL Docs say :

 1. wait_timeout : The number of seconds the server waits for activity on a   noninteractive connection before closing it. The default value is 28800. 2. connect_timeout : The number of seconds that the mysqld server waits for   a connect packet before responding with Bad handshake. The default value is 10 seconds.

connect_timeout mysql is mapped to timeout defined in data_base.yml rails which is set to 5 seconds default.


If you use checkout_timeout, the unit is in seconds.